Re: Some additional PostgreSQL questions - Mailing list pgsql-sql

From Tom Lane
Subject Re: Some additional PostgreSQL questions
Date
Msg-id 2976.1022596686@sss.pgh.pa.us
Whole thread Raw
In response to Re: Some additional PostgreSQL questions  (schaefer@alphanet.ch)
List pgsql-sql
schaefer@alphanet.ch writes:
> The funny thing is the DELETE not saying an error, but not deleting (which
> is good, but I would like an error).
>> 
>> Then make your trigger raise an error.  Returning NULL out of the

> It does:

Hm.  The "NEW.lot" part will not work in an AFTER DELETE trigger (I'm a
bit surprised that it doesn't raise an error --- I guess it is inserting
a NULL instead).  You want OLD.lot for the DELETE case.

I don't know why you are getting the DELETE 0 result, but it's not
because of this trigger.  AFTER triggers can't suppress individual
row actions, because the action is already done --- the most they
can do is raise an error to abort the whole transaction.  Perhaps
you still have a BEFORE trigger in there somewhere?
        regards, tom lane


pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Triggers and System Tables.
Next
From: "Michael Beckstette"
Date:
Subject: dynamic table names, determined by calling parameter