Re: before and after triggers - Mailing list pgsql-general

From Stephan Szabo
Subject Re: before and after triggers
Date
Msg-id 20030404102251.L95184-100000@megazone23.bigpanda.com
Whole thread Raw
In response to before and after triggers  (Dennis Gearon <gearond@cvc.net>)
List pgsql-general

On Fri, 4 Apr 2003, Dennis Gearon wrote:

> After reading the manual, this point didn't seem to have been made. Trigger
> fucntions are supposed to return OPAQUE, (i.e. 'void' in 'C/++' syntax). But the

That's not what opaque means, or more precisely not only what opaque means
(it also is rows from triggers, internal values like C strings and
probably some other things).  In 7.4, triggers return trigger.

> manuals also say that BEFORE triggers can return NULL to avoid the INSERT or
> UPDATE from occurring. Is this contradictory? Is that actually ONE way to avoid
> a UPDATE or INSERTION from happening?
>

> BEFORE TRIGGERS
>     Can change the values in the NEW Tuple for:
>         INSERTS and UPDATES.
>     Can void the action of:
>         INSERTS and UPDATES
>         by returning NULL. (does this kill the transaction?)
The action is ignored (for this row), but it's not an error condition and
doesn't kill the transaction.

> ALL TRIGGERS
>     Are not DEFERRABLE in anyway. They happen immediately:
>         AFTER or BEFORE each ROW is acted upon.

IIRC after triggers are run after the statement mods are completed so I
think right now it's

before triggers row1
row1
before triggers row2
row2
after triggers row1
after triggers row2


pgsql-general by date:

Previous
From: Dennis Gearon
Date:
Subject: before and after triggers
Next
From: Dennis Gearon
Date:
Subject: Simpler question about timestamp