Sometimes your trigger functions may run into the Multiversion Concurrency Control (MVCC) visibility rules of how PostgreSQL's system interacts with changes to data.
A function declared
IMMUTABLE will never see changes applied to the underlying table by previous triggers.
VOLATILE function follows more complex rules, which are in a nutshell as follows:
BEFOREtriggers see no changes made by the current statement, and statement-level
AFTERtriggers see all of the changes made by the statement.
BEFOREtriggers, as the operation has not happened yet. Changes made by other triggers to other rows in the same statement ...