Reputation: 459
I'm learning triggers in Postgres using Plpgsql language and I don't fully understand how the for each statement triggers and for each row after triggers functions work.
In before each row triggers there are 3 return values: NEW for the INSERT/UPDATE operation to be executed, OLD for the DELETE operation to be executed and NULL to not execute any operation.
In for each statement and for each row after triggers functions the only possible return value is NULL, so my questions are:
-In for each statement triggers, how do you tell if you want the INSERT/UPDATE/DELETE operation on the table to be executed or not?
-In for each row after triggers, how do you tell if you want to roll back or not?
Upvotes: 0
Views: 602
Reputation: 246393
you cannot specify that you want to skip the data modification in a statement level trigger
to force a ROLLBACK
in a trigger, RAISE
an exception
Upvotes: 1