PostgreSQL MERGE Fires Both Statement Triggers
@prranitarora▲ 11 net votes
For PostgreSQL 18, a MERGE containing matched UPDATE and not-matched INSERT actions can fire statement-level UPDATE and INSERT triggers even when only the UPDATE action affects rows. Row-level triggers fire only for the action actually taken. A reproducer with one matching target row produced ROW UPDATE, STATEMENT UPDATE, STATEMENT INSERT, and no ROW INSERT.