Karl O. Pinc wrote:
Hi, I want to write a plpgsql function for use as a BEFORE ... EACH ROW function. I want to modify other tables even when the function returns NULL and therefore the table on which the BEFORE trigger is defined is not updated.
Sorry for being paranoid about this but I want to double check before relying on behavior that few people probably use.
I think it's fairly common, actually. Returning NULL is cancelling the update *of that row* rather than aborting the transaction, so all side-effects should always survive.
Otherwise you couldn't update 100 rows and just skip one or two by returning NULL from a before trigger.
-- Richard Huxton Archonet Ltd