PostgreSQL Source Code  git master
event_trigger.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * event_trigger.h
4  * Declarations for command trigger handling.
5  *
6  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/commands/event_trigger.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef EVENT_TRIGGER_H
14 #define EVENT_TRIGGER_H
15 
16 #include "catalog/dependency.h"
17 #include "catalog/objectaddress.h"
19 #include "nodes/parsenodes.h"
20 #include "tcop/deparse_utility.h"
21 #include "utils/aclchk_internal.h"
22 
23 typedef struct EventTriggerData
24 {
26  const char *event; /* event name */
27  Node *parsetree; /* parse tree */
28  const char *tag; /* command tag */
30 
31 #define AT_REWRITE_ALTER_PERSISTENCE 0x01
32 #define AT_REWRITE_DEFAULT_VAL 0x02
33 #define AT_REWRITE_COLUMN_REWRITE 0x04
34 
35 /*
36  * EventTriggerData is the node type that is passed as fmgr "context" info
37  * when a function is called by the event trigger manager.
38  */
39 #define CALLED_AS_EVENT_TRIGGER(fcinfo) \
40  ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData))
41 
43 extern void RemoveEventTriggerById(Oid trigOid);
44 extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok);
45 
47 extern ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId);
48 extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId);
49 
50 extern bool EventTriggerSupportsObjectType(ObjectType obtype);
51 extern bool EventTriggerSupportsObjectClass(ObjectClass objclass);
54 extern void EventTriggerSQLDrop(Node *parsetree);
55 extern void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason);
56 
57 extern bool EventTriggerBeginCompleteQuery(void);
58 extern void EventTriggerEndCompleteQuery(void);
59 extern bool trackDroppedObjectsNeeded(void);
60 extern void EventTriggerSQLDropAddObject(const ObjectAddress *object,
61  bool original, bool normal);
62 
63 extern void EventTriggerInhibitCommandCollection(void);
65 
67  ObjectAddress secondaryObject,
68  Node *parsetree);
69 
71 extern void EventTriggerAlterTableRelid(Oid objectId);
72 extern void EventTriggerCollectAlterTableSubcmd(Node *subcmd,
73  ObjectAddress address);
74 extern void EventTriggerAlterTableEnd(void);
75 
76 extern void EventTriggerCollectGrant(InternalGrant *istmt);
78  Oid opfamoid, List *operators,
79  List *procedures);
81  Oid opcoid, List *operators,
82  List *procedures);
84  Oid cfgId, Oid *dictIds, int ndicts);
86 
87 #endif /* EVENT_TRIGGER_H */
bool EventTriggerSupportsObjectType(ObjectType obtype)
void EventTriggerCollectAlterTableSubcmd(Node *subcmd, ObjectAddress address)
Oid CreateEventTrigger(CreateEventTrigStmt *stmt)
void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt)
Definition: nodes.h:525
const char * tag
Definition: event_trigger.h:28
void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason)
void EventTriggerCollectCreateOpClass(CreateOpClassStmt *stmt, Oid opcoid, List *operators, List *procedures)
void EventTriggerDDLCommandEnd(Node *parsetree)
void EventTriggerEndCompleteQuery(void)
unsigned int Oid
Definition: postgres_ext.h:31
NodeTag
Definition: nodes.h:26
bool trackDroppedObjectsNeeded(void)
bool EventTriggerBeginCompleteQuery(void)
void EventTriggerAlterTableRelid(Oid objectId)
const char * event
Definition: event_trigger.h:26
bool EventTriggerSupportsObjectClass(ObjectClass objclass)
ObjectClass
Definition: dependency.h:89
void RemoveEventTriggerById(Oid trigOid)
void EventTriggerCollectSimpleCommand(ObjectAddress address, ObjectAddress secondaryObject, Node *parsetree)
void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId)
Oid get_event_trigger_oid(const char *trigname, bool missing_ok)
void EventTriggerCollectAlterOpFam(AlterOpFamilyStmt *stmt, Oid opfamoid, List *operators, List *procedures)
void EventTriggerInhibitCommandCollection(void)
ObjectType
Definition: parsenodes.h:1669
void EventTriggerSQLDrop(Node *parsetree)
void EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, Oid cfgId, Oid *dictIds, int ndicts)
void EventTriggerDDLCommandStart(Node *parsetree)
void EventTriggerCollectGrant(InternalGrant *istmt)
ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId)
struct EventTriggerData EventTriggerData
void EventTriggerUndoInhibitCommandCollection(void)
const char * name
Definition: encode.c:521
void EventTriggerAlterTableStart(Node *parsetree)
Definition: pg_list.h:50
void EventTriggerAlterTableEnd(void)
Oid AlterEventTrigger(AlterEventTrigStmt *stmt)
void EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool normal)