Triggers are objects associated with a table that are used to execute operations stored in special functions when some operation (or event) happens on a single row or over the entire table. The trigger can be activated before or after the following events: INSERT
, DELETE
, UPDATE
, or TRUNCATE
. There is still a special behavior of a trigger that makes it able to execute the associated procedure instead of a certain event, this kind of trigger is known as constraint trigger
.
Attribute | Description |
---|---|
Type |
The type of trigger that is being configured. Possible values are Ordinary trigger and Constraint trigger . Extra attributes are enabled when configuring constraint triggers. |
Events |
Set of events when the trigger should be executed. |
Execution |
The moment when the trigger must be fired. Possible values are BEFORE , AFTER , and INSTEAD OF (this value is available only for constraint triggers). |
FOR EACH ROW |
The trigger must be executed each time a row changes. |
Function |
Function that will be executed when the trigger is fired. The function must return trigger and take no argument. |
Transition table names |
Defines custom names for the transition tables (relations) OLD and NEW during the trigger execution. |
Arguments |
A set of literal arguments optionally passed to the trigger at runtime. These arguments must be treated inside the trigger's function. |
Columns |
List of columns of the trigger's owner table that will cause the trigger to be activated in case of an UPDATE on those columns. If the trigger is configured with INSTEAD OF it can't be used with a list of columns. |
Constraint |
This tab handles the constraint trigger attributes. Constraint triggers work like a regular triggers but they can have the firing time adjusted through the command SET CONSTRAINTS. |
Deferrable |
Indicates if the constraint trigger can be deferred or not. The deferral mode is configurable only when this option is checked and the accepted values are INITIALLY IMMEDIATE and INITIALLY DEFERRED . |
Referenced Table |
Table referenced by the constraint trigger. |
Condition |
A boolean expression that determines when the trigger function will actually be executed. |