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.