Re: Delete Cascade

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
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 16:26:08
Message-ID: Pine.BSF.4.21.0103120825180.96264-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Add ON DELETE CASCADE to the references in book.

On Mon, 12 Mar 2001, 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.
>
> When I run
>
> delete from author where author_cod = <number>
>
> I dont get the row deleted if there is a row referenced by in the book table.
> How can I delete my rows in cascade ???

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-03-12 16:27:51 Re: Poor Delete performance
Previous Message Mark G. Gilmore 2001-03-12 16:17:54 Re: Create trigger problem :