This page in other versions: 9.0 / 9.1 / 9.2 / 9.3 / 9.4  |  Development versions: devel  |  Unsupported versions: 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3 / 8.4

44.36. pg_trigger

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

Table 44-36. pg_trigger Columns

Name Type References Description
tgrelid oid pg_class.oid The table this trigger is on
tgname name   Trigger name (must be unique among triggers of same table)
tgfoid oid pg_proc.oid The function to be called
tgtype int2   Bit mask identifying trigger conditions
tgenabled char   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.
tgisconstraint bool   True if trigger is a "constraint trigger"
tgconstrname name   Constraint name, if a constraint trigger
tgconstrrelid oid pg_class.oid The table referenced by a referential integrity constraint
tgconstraint oid pg_constraint.oid The pg_constraint entry owning the trigger, if any
tgdeferrable bool   True if constraint trigger is deferrable
tginitdeferred bool   True if constraint trigger is initially deferred
tgnargs int2   Number of argument strings passed to trigger function
tgattr int2vector   Currently unused
tgargs bytea   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.

Comments


Aug. 28, 2009, 7:02 p.m.

For tgtype, here are the mask values:

Bit 0: Set if ROW, not set if STATEMENT
Bit 1: Set if BEFORE, not set if AFTER
Bit 2: Set if ON INSERT,
Bit 3: Set if ON DELETE
Bit 4: Set if ON UPDATE
Bit 5: Set if ON TRUNCATE
Bit 6: Not used
Bit 7: Not used

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group