blob: e603a3f8dc4d6ad723d2b5d2d938784b029b6f56 (
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
|
/*-------------------------------------------------------------------------
*
* trigger.h--
* prototypes for trigger.c.
*
*
*-------------------------------------------------------------------------
*/
#ifndef TRIGGER_H
#define TRIGGER_H
#include "access/tupdesc.h"
#include "access/htup.h"
#include "utils/rel.h"
typedef uint32 TriggerAction;
#define TRIGGER_ACTION_INSERT 0x00000000
#define TRIGGER_ACTION_DELETE 0x00000001
#define TRIGGER_ACTION_UPDATE 0x00000010
#define TRIGGER_ACTION_OPMASK 0x00000011
#define TRIGGER_ACTION_ROW 4
#define TRIGGER_FIRED_BY_INSERT (action) \
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
TRIGGER_ACTION_INSERT)
#define TRIGGER_FIRED_BY_DELETE (action) \
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
TRIGGER_ACTION_DELETE)
#define TRIGGER_FIRED_BY_UPDATE (action) \
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
TRIGGER_ACTION_UPDATE)
#define TRIGGER_FIRED_FOR_ROW (action) \
((TriggerAction) action & TRIGGER_ACTION_ROW)
#define TRIGGER_FIRED_FOR_STATEMENT (action) \
(!TRIGGER_FIRED_FOR_ROW (action))
extern void CreateTrigger (CreateTrigStmt *stmt);
extern void DropTrigger (DropTrigStmt *stmt);
extern HeapTuple ExecBRInsertTriggers (Relation rel, HeapTuple tuple);
extern void ExecARInsertTriggers (Relation rel, HeapTuple tuple);
extern bool ExecBRDeleteTriggers (Relation rel, ItemPointer tupleid);
extern void ExecARDeleteTriggers (Relation rel, ItemPointer tupleid);
extern HeapTuple ExecBRUpdateTriggers (Relation rel, ItemPointer tupleid, HeapTuple tuple);
extern void ExecARUpdateTriggers (Relation rel, ItemPointer tupleid, HeapTuple tuple);
#endif /* TRIGGER_H */
|