summaryrefslogtreecommitdiffstats
path: root/src/include/utils/reltrigger.h
blob: 7dc7699b5c6f1f69917b4c72f97bb1a5c99e3d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*-------------------------------------------------------------------------
 *
 * reltrigger.h
 *	  POSTGRES relation trigger definitions.
 *
 *
 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/utils/reltrigger.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef RELTRIGGER_H
#define RELTRIGGER_H


/*
 * These struct really belongs to trigger.h, but we put it separately so that
 * it can be cleanly included in rel.h and other places.
 */

typedef struct Trigger
{
	Oid			tgoid;			/* OID of trigger (pg_trigger row) */
	/* Remaining fields are copied from pg_trigger, see pg_trigger.h */
	char	   *tgname;
	Oid			tgfoid;
	int16		tgtype;
	char		tgenabled;
	bool		tgisinternal;
	bool		tgisclone;
	Oid			tgconstrrelid;
	Oid			tgconstrindid;
	Oid			tgconstraint;
	bool		tgdeferrable;
	bool		tginitdeferred;
	int16		tgnargs;
	int16		tgnattr;
	int16	   *tgattr;
	char	  **tgargs;
	char	   *tgqual;
	char	   *tgoldtable;
	char	   *tgnewtable;
} Trigger;

typedef struct TriggerDesc
{
	Trigger    *triggers;		/* array of Trigger structs */
	int			numtriggers;	/* number of array entries */

	/*
	 * These flags indicate whether the array contains at least one of each
	 * type of trigger.  We use these to skip searching the array if not.
	 */
	bool		trig_insert_before_row;
	bool		trig_insert_after_row;
	bool		trig_insert_instead_row;
	bool		trig_insert_before_statement;
	bool		trig_insert_after_statement;
	bool		trig_update_before_row;
	bool		trig_update_after_row;
	bool		trig_update_instead_row;
	bool		trig_update_before_statement;
	bool		trig_update_after_statement;
	bool		trig_delete_before_row;
	bool		trig_delete_after_row;
	bool		trig_delete_instead_row;
	bool		trig_delete_before_statement;
	bool		trig_delete_after_statement;
	/* there are no row-level truncate triggers */
	bool		trig_truncate_before_statement;
	bool		trig_truncate_after_statement;
	/* Is there at least one trigger specifying each transition relation? */
	bool		trig_insert_new_table;
	bool		trig_update_old_table;
	bool		trig_update_new_table;
	bool		trig_delete_old_table;
} TriggerDesc;

#endif							/* RELTRIGGER_H */