before and after triggers
От | Dennis Gearon |
---|---|
Тема | before and after triggers |
Дата | |
Msg-id | 3E8DCC40.1030501@cvc.net обсуждение исходный текст |
Ответы |
Re: before and after triggers
Re: before and after triggers |
Список | pgsql-general |
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 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? My understanding, inferred different parts of diffeent manuals, is the below, correct me if I'm wrong: 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?) Can stop completely an action with an error message for: INSERTS,DELETES, and UPDATES by RAISING an EXCEPTION. (This DOES Kill the xaction) AFTER TRIGGERS Can stop completely an action with an error message: INSERTS,DELETES, and UPDATES by RAISING an EXCEPTION. (This DOES Kill the xaction) Have the advantage of seeing the final results of an action on a table before canceling it. ALL TRIGGERS Are not DEFERRABLE in anyway. They happen immediately: AFTER or BEFORE each ROW is acted upon.
В списке pgsql-general по дате отправления: