Re: before and after triggers

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Dennis Gearon <gearond(at)cvc(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: before and after triggers
Date: 2003-04-04 18:33:18
Message-ID: 20030404102251.L95184-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-04-04 18:37:37 Simpler question about timestamp
Previous Message Dennis Gearon 2003-04-04 18:17:36 before and after triggers