CREATE [ CONSTRAINT ] TRIGGER name { BEFORE | AFTER | INSTEAD OF } { event [ OR ... ] }
- ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
+ ON table
[ FROM referenced_table_name ]
{ NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
+ [ FOR [ EACH ] { ROW | STATEMENT } ]
[ WHEN ( condition ) ]
EXECUTE PROCEDURE function_name ( arguments )
deletes fire after> the cascaded DELETE> completes.
The
PostgreSQL behavior is for
BEFORE
DELETE to always fire before the delete action, even a cascading
- one. This is considered more consistent. There is also unpredictable
- behavior when BEFORE triggers modify rows or prevent
+ one. This is considered more consistent. There is also nonstandard
+ behavior if BEFORE triggers modify rows or prevent
updates during an update that is caused by a referential action. This can
lead to constraint violations or stored data that does not honor the
referential constraint.