Fix pg_dump bug in the database-level collation patch. "datcollate" and
[PostgreSQL.git] / src / include / catalog / pg_trigger.h
blob1dff948e61ed5c2c2ed0605bab431b9685c82e0a
1 /*-------------------------------------------------------------------------
3 * pg_trigger.h
4 * definition of the system "trigger" relation (pg_trigger)
5 * along with the relation's initial contents.
8 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $PostgreSQL$
13 * NOTES
14 * the genbki.sh script reads this file and generates .bki
15 * information from the DATA() statements.
17 *-------------------------------------------------------------------------
19 #ifndef PG_TRIGGER_H
20 #define PG_TRIGGER_H
22 #include "catalog/genbki.h"
24 /* ----------------
25 * pg_trigger definition. cpp turns this into
26 * typedef struct FormData_pg_trigger
28 * Note: when tgconstraint is nonzero, tgisconstraint must be true, and
29 * tgconstrname, tgconstrrelid, tgdeferrable, tginitdeferred are redundant
30 * with the referenced pg_constraint entry. The reason we keep these fields
31 * is that we support "stand-alone" constraint triggers with no corresponding
32 * pg_constraint entry.
33 * ----------------
35 #define TriggerRelationId 2620
37 CATALOG(pg_trigger,2620)
39 Oid tgrelid; /* relation trigger is attached to */
40 NameData tgname; /* trigger's name */
41 Oid tgfoid; /* OID of function to be called */
42 int2 tgtype; /* BEFORE/AFTER UPDATE/DELETE/INSERT
43 * ROW/STATEMENT; see below */
44 char tgenabled; /* trigger's firing configuration WRT
45 * session_replication_role */
46 bool tgisconstraint; /* trigger is a constraint trigger */
47 NameData tgconstrname; /* constraint name */
48 Oid tgconstrrelid; /* constraint's FROM table, if any */
49 Oid tgconstraint; /* owning pg_constraint entry, if any */
50 bool tgdeferrable; /* constraint trigger is deferrable */
51 bool tginitdeferred; /* constraint trigger is deferred initially */
52 int2 tgnargs; /* # of extra arguments in tgargs */
54 /* VARIABLE LENGTH FIELDS: */
55 int2vector tgattr; /* reserved for column-specific triggers */
56 bytea tgargs; /* first\000second\000tgnargs\000 */
57 } FormData_pg_trigger;
59 /* ----------------
60 * Form_pg_trigger corresponds to a pointer to a tuple with
61 * the format of pg_trigger relation.
62 * ----------------
64 typedef FormData_pg_trigger *Form_pg_trigger;
66 /* ----------------
67 * compiler constants for pg_trigger
68 * ----------------
70 #define Natts_pg_trigger 14
71 #define Anum_pg_trigger_tgrelid 1
72 #define Anum_pg_trigger_tgname 2
73 #define Anum_pg_trigger_tgfoid 3
74 #define Anum_pg_trigger_tgtype 4
75 #define Anum_pg_trigger_tgenabled 5
76 #define Anum_pg_trigger_tgisconstraint 6
77 #define Anum_pg_trigger_tgconstrname 7
78 #define Anum_pg_trigger_tgconstrrelid 8
79 #define Anum_pg_trigger_tgconstraint 9
80 #define Anum_pg_trigger_tgdeferrable 10
81 #define Anum_pg_trigger_tginitdeferred 11
82 #define Anum_pg_trigger_tgnargs 12
83 #define Anum_pg_trigger_tgattr 13
84 #define Anum_pg_trigger_tgargs 14
86 /* Bits within tgtype */
87 #define TRIGGER_TYPE_ROW (1 << 0)
88 #define TRIGGER_TYPE_BEFORE (1 << 1)
89 #define TRIGGER_TYPE_INSERT (1 << 2)
90 #define TRIGGER_TYPE_DELETE (1 << 3)
91 #define TRIGGER_TYPE_UPDATE (1 << 4)
92 #define TRIGGER_TYPE_TRUNCATE (1 << 5)
94 /* Macros for manipulating tgtype */
95 #define TRIGGER_CLEAR_TYPE(type) ((type) = 0)
97 #define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW)
98 #define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE)
99 #define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT)
100 #define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE)
101 #define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE)
102 #define TRIGGER_SETT_TRUNCATE(type) ((type) |= TRIGGER_TYPE_TRUNCATE)
104 #define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW)
105 #define TRIGGER_FOR_BEFORE(type) ((type) & TRIGGER_TYPE_BEFORE)
106 #define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT)
107 #define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE)
108 #define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE)
109 #define TRIGGER_FOR_TRUNCATE(type) ((type) & TRIGGER_TYPE_TRUNCATE)
111 #endif /* PG_TRIGGER_H */