44.36. pg_trigger

The catalog pg_trigger stores triggers on tables. See CREATE TRIGGER for more information.

Table 44-36. pg_trigger Columns

NameTypeReferencesDescription
tgrelidoidpg_class.oidThe table this trigger is on
tgnamename Trigger name (must be unique among triggers of same table)
tgfoidoidpg_proc.oidThe function to be called
tgtypeint2 Bit mask identifying trigger conditions
tgenabledchar  Controls in which session_replication_role modes the trigger fires. O = trigger fires in "origin" and "local" modes, D = trigger is disabled, R = trigger fires in "replica" mode, A = trigger fires always.
tgisconstraintbool True if trigger is a "constraint trigger"
tgconstrnamename Constraint name, if a constraint trigger
tgconstrrelidoidpg_class.oidThe table referenced by a referential integrity constraint
tgconstraintoidpg_constraint.oidThe pg_constraint entry owning the trigger, if any
tgdeferrablebool True if constraint trigger is deferrable
tginitdeferredbool True if constraint trigger is initially deferred
tgnargsint2 Number of argument strings passed to trigger function
tgattrint2vector Currently unused
tgargsbytea Argument strings to pass to trigger, each NULL-terminated

Note: When tgconstraint is nonzero, tgisconstraint must be true, and tgconstrname, tgconstrrelid, tgdeferrable, tginitdeferred are redundant with the referenced pg_constraint entry. The reason we keep these fields is that we support "stand-alone" constraint triggers with no corresponding pg_constraint entry.

Note: pg_class.relhastriggers must be true if a table has any triggers in this catalog.