Re: Delete Cascade

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Marcelo Pereira <gandalf(at)sum(dot)desktop(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Delete Cascade
Date: 2001-03-12 15:15:01
Message-ID: 20010312161501.B21006@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 12, 2001 at 12:07:13PM -0300, Marcelo Pereira wrote:
> Hi,
>
> I am in trouble deleting rows in cascade.
>
> I have a scheme like this:
>
> create table author (author_cod integer primary key, author_name char(20));
> create table book (book_cod integer primary key, book_autor integer references author(author_cod), book_title char(30));
>
> I would like to delete a 'author' in the author table and also all your books in the book table.

create table book (
book_cod integer primary key,
book_autor integer
references author(author_cod)
on delete cascade,
book_title char(30)
);

What is bad on PG's docs? ...see:

[ CONSTRAINT name ] REFERENCES reftable [ ( refcolumn ) ]
[ MATCH matchtype ]
[ ON DELETE action ]
[ ON UPDATE action ]
[ [ NOT ] DEFERRABLE ]
[ INITIALLY checktime ]

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Renaud Tthonnart 2001-03-12 15:26:21 Re: Counting elements of an array
Previous Message Tom Lane 2001-03-12 15:10:57 Re: Poor Delete performance