1 /*-------------------------------------------------------------------------
2  *
3  * reltrigger.h
4  *	  POSTGRES relation trigger definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/reltrigger.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef RELTRIGGER_H
15 #define RELTRIGGER_H
16 
17 
18 /*
19  * These struct really belongs to trigger.h, but we put it separately so that
20  * it can be cleanly included in rel.h and other places.
21  */
22 
23 typedef struct Trigger
24 {
25 	Oid			tgoid;			/* OID of trigger (pg_trigger row) */
26 	/* Remaining fields are copied from pg_trigger, see pg_trigger.h */
27 	char	   *tgname;
28 	Oid			tgfoid;
29 	int16		tgtype;
30 	char		tgenabled;
31 	bool		tgisinternal;
32 	Oid			tgconstrrelid;
33 	Oid			tgconstrindid;
34 	Oid			tgconstraint;
35 	bool		tgdeferrable;
36 	bool		tginitdeferred;
37 	int16		tgnargs;
38 	int16		tgnattr;
39 	int16	   *tgattr;
40 	char	  **tgargs;
41 	char	   *tgqual;
42 } Trigger;
43 
44 typedef struct TriggerDesc
45 {
46 	Trigger    *triggers;		/* array of Trigger structs */
47 	int			numtriggers;	/* number of array entries */
48 
49 	/*
50 	 * These flags indicate whether the array contains at least one of each
51 	 * type of trigger.  We use these to skip searching the array if not.
52 	 */
53 	bool		trig_insert_before_row;
54 	bool		trig_insert_after_row;
55 	bool		trig_insert_instead_row;
56 	bool		trig_insert_before_statement;
57 	bool		trig_insert_after_statement;
58 	bool		trig_update_before_row;
59 	bool		trig_update_after_row;
60 	bool		trig_update_instead_row;
61 	bool		trig_update_before_statement;
62 	bool		trig_update_after_statement;
63 	bool		trig_delete_before_row;
64 	bool		trig_delete_after_row;
65 	bool		trig_delete_instead_row;
66 	bool		trig_delete_before_statement;
67 	bool		trig_delete_after_statement;
68 	/* there are no row-level truncate triggers */
69 	bool		trig_truncate_before_statement;
70 	bool		trig_truncate_after_statement;
71 } TriggerDesc;
72 
73 #endif   /* RELTRIGGER_H */
74