Re: Removing Rows in Foreign Keys

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: brew(at)theMode(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Removing Rows in Foreign Keys
Date: 2005-04-04 07:47:50
Message-ID: 20050404074750.GB14264@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Apr 04, 2005 at 02:56:56AM -0400, brew(at)theMode(dot)com wrote:
>
> Is there a SQL command that removes both a row in a table and the rows in
> other tables that reference it or do I have to do it manually?

If you define the foreign key constraints as ON DELETE CASCADE,
then referencing rows will be automatically deleted when you DELETE
the referenced row.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message brew 2005-04-04 08:24:03 Re: Removing Rows in Foreign Keys
Previous Message brew 2005-04-04 06:56:56 Removing Rows in Foreign Keys