35.57. triggers
#
The view triggers
contains all triggers defined in the current database on tables and views that the current user owns or has some privilege other than SELECT
on.
Table 35.55. triggers
Columns
Column Type Description |
---|
Name of the database that contains the trigger (always the current database) |
Name of the schema that contains the trigger |
Name of the trigger |
Event that fires the trigger ( |
Name of the database that contains the table that the trigger is defined on (always the current database) |
Name of the schema that contains the table that the trigger is defined on |
Name of the table that the trigger is defined on |
Firing order among triggers on the same table having the same |
|
Statement that is executed by the trigger (currently always |
Identifies whether the trigger fires once for each processed row or once for each statement ( |
Time at which the trigger fires ( |
Name of the “old” transition table, or null if none |
Name of the “new” transition table, or null if none |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Triggers in Postgres Pro have two incompatibilities with the SQL standard that affect the representation in the information schema. First, trigger names are local to each table in Postgres Pro, rather than being independent schema objects. Therefore there can be duplicate trigger names defined in one schema, so long as they belong to different tables. (trigger_catalog
and trigger_schema
are really the values pertaining to the table that the trigger is defined on.) Second, triggers can be defined to fire on multiple events in Postgres Pro (e.g., ON INSERT OR UPDATE
), whereas the SQL standard only allows one. If a trigger is defined to fire on multiple events, it is represented as multiple rows in the information schema, one for each type of event. As a consequence of these two issues, the primary key of the view triggers
is really (trigger_catalog, trigger_schema, event_object_table, trigger_name, event_manipulation)
instead of (trigger_catalog, trigger_schema, trigger_name)
, which is what the SQL standard specifies. Nonetheless, if you define your triggers in a manner that conforms with the SQL standard (trigger names unique in the schema and only one event type per trigger), this will not affect you.
Note
Prior to PostgreSQL 9.1, this view's columns action_timing
, action_reference_old_table
, action_reference_new_table
, action_reference_old_row
, and action_reference_new_row
were named condition_timing
, condition_reference_old_table
, condition_reference_new_table
, condition_reference_old_row
, and condition_reference_new_row
respectively. That was how they were named in the SQL:1999 standard. The new naming conforms to SQL:2003 and later.