Visibility
Sometimes, your trigger functions might run into the Multiversion Concurrency Control (MVCC) visibility rules of how PostgreSQL's system interacts with changes to data.
A function declared as STABLE
or IMMUTABLE
will never see changes applied to the underlying table by the previous triggers.
A VOLATILE
function follows more complex rules which are, in a nutshell, as follows:
- The statement-level
BEFORE
triggers detects whether no changes are made by the current statement, and the statement-levelAFTER
triggers detects all of the changes made by the statement. - Data changes by the operation to the row causing the trigger to fire are, of course, not visible to the
BEFORE
triggers, as the operation has not occurred yet. Changes made by other ...
Get PostgreSQL Server Programming - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.