Re: before and after triggers

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: before and after triggers
Дата
Msg-id 20030404102251.L95184-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на before and after triggers  (Dennis Gearon <gearond@cvc.net>)
Список 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 по дате отправления:

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: before and after triggers
Следующее
От: Dennis Gearon
Дата:
Сообщение: Simpler question about timestamp