Oliver Elphick <olly@lfix.co.uk> writes:
> A BEFORE trigger must return the NEW row after possible alterations --
> returning NULL will abort the update or insert, so this must be changed
> to be an AFTER trigger.
Or leave it as a BEFORE trigger and do "RETURN NEW" at the end.
I'd recommend BEFORE triggers over AFTER triggers anytime you have the
choice, because AFTER triggers go into a list of things-to-do-later;
if that list gets large (ie, you do many updates in one command) you
will have performance problems.
regards, tom lane