A database trigger is associated with a specific table, view, or foreign table.
In a database, triggers execute a specified function when certain operations are performed on the table (
SELECT statements do not modify rows so no trigger can be set on a
In a database, triggers can run before, after, or instead of the operation that fired them attempts to alter the row(s).
In PostgreSQL, a trigger set
FOR EACH ROW is called once for every row modified.
FOR EACH STATEMENT executes once for the entire operation (0 modified rows would still trigger this).
A database trigger can specify a boolean
WHEN condition to set when it should be fired.
Multiple database triggers of the same kind can exist on the same table. If so, they are triggered in alphabetical order.
To remove a trigger from a table/view you can use the
DROP TRIGGER command.
One SQL command can trigger more than one kind of trigger. For example, an insert can fire a trigger that updates a record creating a conflict that triggers an update on conflict trigger.