Re: deleting the master but not the detail

From: "Ismael (dot)(dot)(dot)(dot)" <ismaelpsp(at)hotmail(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: deleting the master but not the detail
Date: 2008-07-17 20:22:49
Message-ID: BLU103-W21AF47FF3F24BD23FD670DA38E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
>> So is there no other way to do it but to verify the integrity using triggers
>> and drop the referential constraints?
>
> Well, you could do something using a before delete trigger on the
> referencing table that returns NULL to avoid the delete as well, but
> making it only prevent the deletions caused by the referential constraints
> might be difficult.
>

That's right, It's easier to verify the existence of the master before inserting
something in the details than controlling the way something gets deleted.
After all, is only a
PERFORM * FROM.... WHERE NEW.....
IF NOT FOUND THEN
RISE EXCEPTION 'that doesn't exists';...
_________________________________________________________________
Plug&Play te trae en exclusiva los mejores conciertos de la red
http://club.prodigymsn.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ismael .... 2008-07-17 20:30:53 Re: in query variables....
Previous Message Douglas McNaught 2008-07-17 19:21:43 Re: [HACKERS] postmaster.pid not visible