Re: Delete across 5 Joined tables - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Delete across 5 Joined tables
Date
Msg-id 48A88DBD.2070701@iol.ie
Whole thread Raw
In response to Delete across 5 Joined tables  (Fuzzygoth <dav.phillips@ntlworld.com>)
List pgsql-general
On 15/08/2008 11:08, Fuzzygoth wrote:

> but I need to be able to delete from up to 5 different tables, is
> there a quick and
> simple way of doing this? can someone post an example?

Just guessing without more detailed information, but are the tables
related one-to-many using foreign keys? If so, when defining the foreign
key you can set the delete to cascade whenever a "master" row is deleted:

alter table foo
   add constraint foo_fk foreign key [...]
   on delete cascade;

...or something like that.

Ray.


------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: "Dmitry Koterov"
Date:
Subject: Open source PostgreSQL type parsers in PHP?
Next
From: "Kim Robinson"
Date:
Subject: Postres.exe Processes Hang