]> begriffs open source - ai-pg/blob - full-docs/txt/catalog-pg-trigger.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / catalog-pg-trigger.txt
1
2 52.58. pg_trigger #
3
4    The catalog pg_trigger stores triggers on tables and views. See CREATE
5    TRIGGER for more information.
6
7    Table 52.58. pg_trigger Columns
8
9    Column Type
10
11    Description
12
13    oid oid
14
15    Row identifier
16
17    tgrelid oid (references pg_class.oid)
18
19    The table this trigger is on
20
21    tgparentid oid (references pg_trigger.oid)
22
23    Parent trigger that this trigger is cloned from (this happens when
24    partitions are created or attached to a partitioned table); zero if not
25    a clone
26
27    tgname name
28
29    Trigger name (must be unique among triggers of same table)
30
31    tgfoid oid (references pg_proc.oid)
32
33    The function to be called
34
35    tgtype int2
36
37    Bit mask identifying trigger firing conditions
38
39    tgenabled char
40
41    Controls in which session_replication_role modes the trigger fires. O =
42    trigger fires in “origin” and “local” modes, D = trigger is disabled, R
43    = trigger fires in “replica” mode, A = trigger fires always.
44
45    tgisinternal bool
46
47    True if trigger is internally generated (usually, to enforce the
48    constraint identified by tgconstraint)
49
50    tgconstrrelid oid (references pg_class.oid)
51
52    The table referenced by a referential integrity constraint (zero if
53    trigger is not for a referential integrity constraint)
54
55    tgconstrindid oid (references pg_class.oid)
56
57    The index supporting a unique, primary key, referential integrity, or
58    exclusion constraint (zero if trigger is not for one of these types of
59    constraint)
60
61    tgconstraint oid (references pg_constraint.oid)
62
63    The pg_constraint entry associated with the trigger (zero if trigger is
64    not for a constraint)
65
66    tgdeferrable bool
67
68    True if constraint trigger is deferrable
69
70    tginitdeferred bool
71
72    True if constraint trigger is initially deferred
73
74    tgnargs int2
75
76    Number of argument strings passed to trigger function
77
78    tgattr int2vector (references pg_attribute.attnum)
79
80    Column numbers, if trigger is column-specific; otherwise an empty array
81
82    tgargs bytea
83
84    Argument strings to pass to trigger, each NULL-terminated
85
86    tgqual pg_node_tree
87
88    Expression tree (in nodeToString() representation) for the trigger's
89    WHEN condition, or null if none
90
91    tgoldtable name
92
93    REFERENCING clause name for OLD TABLE, or null if none
94
95    tgnewtable name
96
97    REFERENCING clause name for NEW TABLE, or null if none
98
99    Currently, column-specific triggering is supported only for UPDATE
100    events, and so tgattr is relevant only for that event type. tgtype
101    might contain bits for other event types as well, but those are
102    presumed to be table-wide regardless of what is in tgattr.
103
104 Note
105
106    When tgconstraint is nonzero, tgconstrrelid, tgconstrindid,
107    tgdeferrable, and tginitdeferred are largely redundant with the
108    referenced pg_constraint entry. However, it is possible for a
109    non-deferrable trigger to be associated with a deferrable constraint:
110    foreign key constraints can have some deferrable and some
111    non-deferrable triggers.
112
113 Note
114
115    pg_class.relhastriggers must be true if a relation has any triggers in
116    this catalog.