PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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 "utils/aclchk_internal.h"
21 #include "tcop/deparse_utility.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 #define AT_REWRITE_ALTER_OID 0x08
35 
36 /*
37  * EventTriggerData is the node type that is passed as fmgr "context" info
38  * when a function is called by the event trigger manager.
39  */
40 #define CALLED_AS_EVENT_TRIGGER(fcinfo) \
41  ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData))
42 
44 extern void RemoveEventTriggerById(Oid ctrigOid);
45 extern Oid get_event_trigger_oid(const char *trigname, bool missing_ok);
46 
48 extern ObjectAddress AlterEventTriggerOwner(const char *name, Oid newOwnerId);
49 extern void AlterEventTriggerOwner_oid(Oid, Oid newOwnerId);
50 
51 extern bool EventTriggerSupportsObjectType(ObjectType obtype);
52 extern bool EventTriggerSupportsObjectClass(ObjectClass objclass);
54 extern void EventTriggerDDLCommandStart(Node *parsetree);
55 extern void EventTriggerDDLCommandEnd(Node *parsetree);
56 extern void EventTriggerSQLDrop(Node *parsetree);
57 extern void EventTriggerTableRewrite(Node *parsetree, Oid tableOid, int reason);
58 
59 extern bool EventTriggerBeginCompleteQuery(void);
60 extern void EventTriggerEndCompleteQuery(void);
61 extern bool trackDroppedObjectsNeeded(void);
62 extern void EventTriggerSQLDropAddObject(const ObjectAddress *object,
63  bool original, bool normal);
64 
65 extern void EventTriggerInhibitCommandCollection(void);
67 
69  ObjectAddress secondaryObject,
70  Node *parsetree);
71 
72 extern void EventTriggerAlterTableStart(Node *parsetree);
73 extern void EventTriggerAlterTableRelid(Oid objectId);
74 extern void EventTriggerCollectAlterTableSubcmd(Node *subcmd,
75  ObjectAddress address);
76 extern void EventTriggerAlterTableEnd(void);
77 
78 extern void EventTriggerCollectGrant(InternalGrant *istmt);
80  Oid opfamoid, List *operators,
81  List *procedures);
83  Oid opcoid, List *operators,
84  List *procedures);
86  Oid cfgId, Oid *dictIds, int ndicts);
88 
89 #endif /* EVENT_TRIGGER_H */
bool EventTriggerSupportsObjectType(ObjectType obtype)
void EventTriggerCollectAlterTableSubcmd(Node *subcmd, ObjectAddress address)
GrantObjectType
Definition: parsenodes.h:1804
Oid CreateEventTrigger(CreateEventTrigStmt *stmt)
void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt)
Definition: nodes.h:509
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)
bool EventTriggerSupportsGrantObjectType(GrantObjectType objtype)
const char * event
Definition: event_trigger.h:26
bool EventTriggerSupportsObjectClass(ObjectClass objclass)
ObjectClass
Definition: dependency.h:129
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)
void RemoveEventTriggerById(Oid ctrigOid)
ObjectType
Definition: parsenodes.h:1576
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:45
void EventTriggerAlterTableEnd(void)
Oid AlterEventTrigger(AlterEventTrigStmt *stmt)
void EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool normal)