Re: Removing Rows in Foreign Keys

From: brew(at)theMode(dot)com
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: brew(at)theMode(dot)com, pgsql-novice(at)postgresql(dot)org
Subject: Re: Removing Rows in Foreign Keys
Date: 2005-04-04 08:24:03
Message-ID: Pine.BSF.4.58.0504040423000.86885@themode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Michael.....

> > 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.

Ah Ha, thanks muchly!!! That's just what I was looking for.

brew

==========================================================================
Strange Brew (brew(at)theMode(dot)com)
Check out my Stock Option Covered Call website http://www.callpix.com
and my Musician's Online Database Exchange http://www.TheMode.com
==========================================================================

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Stephen P. Christopher 2005-04-04 11:56:36 Re: Installation on Windows XP Home not possible
Previous Message Michael Fuhr 2005-04-04 07:47:50 Re: Removing Rows in Foreign Keys