pg_trigger

The pg_trigger catalog provides information about triggers.

Column name Data type Description
oid oid The OID of the trigger.
tgrelid oid (references pg_class.oid) The OID of the table for which this trigger is defined.
tgparentid oid (references pg_trigger.oid) The parent trigger from which this trigger was cloned, typically during partition creation or attachment.
0 – The trigger is not a clone.
tgname name The name of the trigger. It must be unique among triggers defined on the same table.
tgfoid oid (references pg_proc.oid) The OID of the function that is executed by the trigger.
tgtype int2 A bit mask identifying the trigger’s firing conditions.
tgenabled char Specifies the session_replication_role mode in which the trigger fires.
The possible values are:
  • O – Fires in the origin and local modes.
  • D – Disabled.
  • R – Fires only in the replica mode.
  • A – Always fires.
tgisinternal bool Specifies whether the trigger is internally generated (typically to enforce a constraint referenced by tgconstraint) (TRUE) or not (FALSE).
tgconstrrelid oid (references pg_class.oid) The table referenced by a referential integrity constraint.
0 – The trigger is not related to a referential integrity constraint.
tgconstrindid oid (references pg_class.oid) The index supporting a unique, primary key, referential integrity, or exclusion constraint.
0 – Not applicable.
tgconstraint oid (references pg_constraint.oid) The OID of the pg_constraint entry associated with this trigger.
0 – Not related to a constraint.
tgdeferrable bool Specifies whether the constraint trigger is deferrable (TRUE) or not (FALSE).
tginitdeferred bool Specifies whether the constraint trigger is initially deferred (TRUE) or not (FALSE).
tgnargs int2 The number of argument strings passed to the trigger function.
tgattr int2vector (references pg_attribute.attnum) Column numbers (attribute numbers) when the trigger is column-specific; otherwise an empty array.
tgargs bytea Argument strings passed to the trigger, each NULL-terminated.
tgqual pg_node_tree An expression tree representing the trigger’s WHEN condition, shown in the nodeToString() format.
NULL – No expression tree.
tgoldtable name The referencing clause name for OLD TABLE.
NULL – Not applicable.
tgnewtable name The referencing clause name for NEW TABLE.
NULL – Not applicable.