Jean-Francois Leveque wrote:
> I want to check something before
> a delete is made.
> I made a before delete trigger that
> calls a procedure.
> The procedure raises an exception
> when I don't want the delete to be
> made (I could also have returned NULL,
> but wouldn't have get much information
> from it).
> The question is :
> What do I return when I want the delete to be made ?
> If I return OLD (known when deleting), maybe that
> cancels the delete too.
> I don't have NEW (known only on insert/update).
> I couldn't find the answer in the docs.
Returning OLD from a BEFORE ROW trigger let's the delete
happen - no "maybe" here. On AFTER ROW triggers it doesn't
matter what you return, the delete happened already (well,
RAISE EXCEPTION will rollback of course).
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
In response to
pgsql-hackers by date
|Next:||From: Jean-Francois Leveque||Date: 2001-07-03 13:59:01|
|Subject: Trigger Procedures question|
|Previous:||From: Alex Pilosov||Date: 2001-07-03 13:30:49|
|Subject: Re: selecting from cursor |