Thread: On delete cascade!

On delete cascade!

From
pocm@rnl.ist.utl.pt (Paulo J. Matos)
Date:
Hi all,

On weak entities I've used ON DELETE CASCADE as mentioned in
"Databases Management Systems" by Raghu Ramakrishnan. But I get:
psql:tables.sql:43: ERROR:  parser: parse error at or near "ON"    

on tables like the following:

CREATE TABLE socio_ilumindado (cognome varchar,id integer,nome varchar,alcunha varchar,data_filiacao date,PRIMARY
KEY(id),   FOREIGN KEY(id, nome, alcunha, data_filiacao) REFERENCES socio,ON DELETE CASCADE);
 


How can I change this to be compatible with postgresql?

TIA,
Best regards,

-- 
Paulo J. Matos : pocm(_at_)rnl.ist.utl.pt
Instituto Superior Tecnico - Lisbon    
Software & Computer Engineering - A.I.- > http://www.rnl.ist.utl.pt/~pocm ---    Yes, God had a deadline...    So, He
wroteit all in Lisp!
 



Re: On delete cascade!

From
Stephan Szabo
Date:
On 14 Jan 2002, Paulo J. Matos wrote:

> On weak entities I've used ON DELETE CASCADE as mentioned in
> "Databases Management Systems" by Raghu Ramakrishnan. But I get:
> psql:tables.sql:43: ERROR:  parser: parse error at or near "ON"
>
> on tables like the following:
>
> CREATE TABLE socio_ilumindado (
>     cognome varchar,
>     id integer,
>     nome varchar,
>     alcunha varchar,
>     data_filiacao date,
>     PRIMARY KEY(id),
>      FOREIGN KEY(id, nome, alcunha, data_filiacao) REFERENCES socio,
>     ON DELETE CASCADE);
>
>
> How can I change this to be compatible with postgresql?

We don't want the comma between socio and the ON DELETE CASCADE (which as
far as I can see isn't allowed in the SQL92 spec either, but I may be
missing it).



Re: On delete cascade!

From
Roberto Mello
Date:
On Mon, Jan 14, 2002 at 08:31:36PM +0000, Paulo J. Matos wrote:
> Hi all,
> 
> On weak entities I've used ON DELETE CASCADE as mentioned in
> "Databases Management Systems" by Raghu Ramakrishnan. But I get:
> psql:tables.sql:43: ERROR:  parser: parse error at or near "ON"    
> 
> on tables like the following:
> 
> CREATE TABLE socio_ilumindado (
>     cognome varchar,
>     id integer,
>     nome varchar,
>     alcunha varchar,
>     data_filiacao date,
>     PRIMARY KEY(id),
>      FOREIGN KEY(id, nome, alcunha, data_filiacao) REFERENCES socio,
>     ON DELETE CASCADE);

Ola Paulo,

You need to take a look at the PostgreSQL documentation as well. Just
reading your college databases book won't cut it most of the time.

PostgreSQL has excellent documentation, especially the reference manual.
Take a look at it. So far both of your questions could have been answered
by taking a quick glance at the docs.

http://www.postgresql.org/idocs/

-Roberto

-- 
+----| http://fslc.usu.edu/ USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net/      http://www.sdl.usu.edu/ - Space Dynamics Lab, Developer    
 
Information is the greatest weapon of power to the modern wizard.


Re: On delete cascade!

From
"Steve Boyle \(Roselink\)"
Date:
Is the , after socio the problem here?

sb
----- Original Message ----- 
From: "Roberto Mello" <rmello@cc.usu.edu>
To: "Paulo J. Matos" <pocm@rnl.ist.utl.pt>
Cc: <pgsql-sql@postgresql.org>
Sent: Tuesday, January 15, 2002 6:29 AM
Subject: Re: [SQL] On delete cascade!


> On Mon, Jan 14, 2002 at 08:31:36PM +0000, Paulo J. Matos wrote:
> > Hi all,
> > 
> > On weak entities I've used ON DELETE CASCADE as mentioned in
> > "Databases Management Systems" by Raghu Ramakrishnan. But I get:
> > psql:tables.sql:43: ERROR:  parser: parse error at or near "ON"    
> > 
> > on tables like the following:
> > 
> > CREATE TABLE socio_ilumindado (
> > cognome varchar,
> > id integer,
> > nome varchar,
> > alcunha varchar,
> > data_filiacao date,
> > PRIMARY KEY(id),
> >  FOREIGN KEY(id, nome, alcunha, data_filiacao) REFERENCES socio,
> > ON DELETE CASCADE);
> 
> Ola Paulo,
> 
> You need to take a look at the PostgreSQL documentation as well. Just
> reading your college databases book won't cut it most of the time.
> 
> PostgreSQL has excellent documentation, especially the reference manual.
> Take a look at it. So far both of your questions could have been answered
> by taking a quick glance at the docs.
> 
> http://www.postgresql.org/idocs/
> 
> -Roberto
> 
> -- 
> +----| http://fslc.usu.edu/ USU Free Software & GNU/Linux Club |------+
>   Roberto Mello - Computer Science, USU - http://www.brasileiro.net/ 
>        http://www.sdl.usu.edu/ - Space Dynamics Lab, Developer    
> Information is the greatest weapon of power to the modern wizard.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 



Re: On delete cascade!

From
Erle Czar Mantos
Date:
To You: The problem is on the comman after the word "socio", it shouldn't
have been there!
                                                  Erle

On 14 Jan 2002, Paulo J. Matos wrote:
> Hi all,
>
> On weak entities I've used ON DELETE CASCADE as mentioned in
> "Databases Management Systems" by Raghu Ramakrishnan. But I get:
> psql:tables.sql:43: ERROR:  parser: parse error at or near "ON"
>
> on tables like the following:
>
> CREATE TABLE socio_ilumindado (
>     cognome varchar,
>     id integer,
>     nome varchar,
>     alcunha varchar,
>     data_filiacao date,
>     PRIMARY KEY(id),
>      FOREIGN KEY(id, nome, alcunha, data_filiacao) REFERENCES socio,
>     ON DELETE CASCADE);
>
>
> How can I change this to be compatible with postgresql?
>
> TIA,
> Best regards,
>
>