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