PostgreSQL Source Code  git master
objectaccess.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ObjectAccessPostCreate
 
struct  ObjectAccessDrop
 
struct  ObjectAccessPostAlter
 
struct  ObjectAccessNamespaceSearch
 

Macros

#define InvokeObjectPostCreateHook(classId, objectId, subId)    InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false)
 
#define InvokeObjectPostCreateHookArg(classId, objectId, subId, is_internal)
 
#define InvokeObjectDropHook(classId, objectId, subId)    InvokeObjectDropHookArg((classId),(objectId),(subId),0)
 
#define InvokeObjectDropHookArg(classId, objectId, subId, dropflags)
 
#define InvokeObjectTruncateHook(objectId)
 
#define InvokeObjectPostAlterHook(classId, objectId, subId)
 
#define InvokeObjectPostAlterHookArg(classId, objectId, subId, auxiliaryId, is_internal)
 
#define InvokeNamespaceSearchHook(objectId, ereport_on_violation)
 
#define InvokeFunctionExecuteHook(objectId)
 
#define InvokeObjectPostCreateHookStr(classId, objectName, subId)    InvokeObjectPostCreateHookArgStr((classId),(objectName),(subId),false)
 
#define InvokeObjectPostCreateHookArgStr(classId, objectName, subId, is_internal)
 
#define InvokeObjectDropHookStr(classId, objectName, subId)    InvokeObjectDropHookArgStr((classId),(objectName),(subId),0)
 
#define InvokeObjectDropHookArgStr(classId, objectName, subId, dropflags)
 
#define InvokeObjectTruncateHookStr(objectName)
 
#define InvokeObjectPostAlterHookStr(classId, objectName, subId)
 
#define InvokeObjectPostAlterHookArgStr(classId, objectName, subId, auxiliaryId, is_internal)
 
#define InvokeNamespaceSearchHookStr(objectName, ereport_on_violation)
 
#define InvokeFunctionExecuteHookStr(objectName)
 

Typedefs

typedef enum ObjectAccessType ObjectAccessType
 
typedef void(* object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg)
 
typedef void(* object_access_hook_type_str) (ObjectAccessType access, Oid classId, const char *objectStr, int subId, void *arg)
 

Enumerations

enum  ObjectAccessType {
  OAT_POST_CREATE , OAT_DROP , OAT_POST_ALTER , OAT_NAMESPACE_SEARCH ,
  OAT_FUNCTION_EXECUTE , OAT_TRUNCATE
}
 

Functions

void RunObjectPostCreateHook (Oid classId, Oid objectId, int subId, bool is_internal)
 
void RunObjectDropHook (Oid classId, Oid objectId, int subId, int dropflags)
 
void RunObjectTruncateHook (Oid objectId)
 
void RunObjectPostAlterHook (Oid classId, Oid objectId, int subId, Oid auxiliaryId, bool is_internal)
 
bool RunNamespaceSearchHook (Oid objectId, bool ereport_on_violation)
 
void RunFunctionExecuteHook (Oid objectId)
 
void RunObjectPostCreateHookStr (Oid classId, const char *objectStr, int subId, bool is_internal)
 
void RunObjectDropHookStr (Oid classId, const char *objectStr, int subId, int dropflags)
 
void RunObjectTruncateHookStr (const char *objectStr)
 
void RunObjectPostAlterHookStr (Oid classId, const char *objectStr, int subId, Oid auxiliaryId, bool is_internal)
 
bool RunNamespaceSearchHookStr (const char *objectStr, bool ereport_on_violation)
 
void RunFunctionExecuteHookStr (const char *objectStr)
 

Variables

PGDLLIMPORT object_access_hook_type object_access_hook
 
PGDLLIMPORT object_access_hook_type_str object_access_hook_str
 

Macro Definition Documentation

◆ InvokeFunctionExecuteHook

#define InvokeFunctionExecuteHook (   objectId)
Value:
do { \
RunFunctionExecuteHook(objectId); \
} while(0)
PGDLLIMPORT object_access_hook_type object_access_hook
Definition: objectaccess.c:22

Definition at line 211 of file objectaccess.h.

◆ InvokeFunctionExecuteHookStr

#define InvokeFunctionExecuteHookStr (   objectName)
Value:
do { \
RunFunctionExecuteHookStr(objectName); \
} while(0)
PGDLLIMPORT object_access_hook_type_str object_access_hook_str
Definition: objectaccess.c:23

Definition at line 258 of file objectaccess.h.

◆ InvokeNamespaceSearchHook

#define InvokeNamespaceSearchHook (   objectId,
  ereport_on_violation 
)
Value:
? true \
: RunNamespaceSearchHook((objectId), (ereport_on_violation)))
bool RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation)
Definition: objectaccess.c:115

Definition at line 206 of file objectaccess.h.

◆ InvokeNamespaceSearchHookStr

#define InvokeNamespaceSearchHookStr (   objectName,
  ereport_on_violation 
)
Value:
? true \
: RunNamespaceSearchHookStr((objectName), (ereport_on_violation)))
bool RunNamespaceSearchHookStr(const char *objectStr, bool ereport_on_violation)
Definition: objectaccess.c:241

Definition at line 253 of file objectaccess.h.

◆ InvokeObjectDropHook

#define InvokeObjectDropHook (   classId,
  objectId,
  subId 
)     InvokeObjectDropHookArg((classId),(objectId),(subId),0)

Definition at line 180 of file objectaccess.h.

◆ InvokeObjectDropHookArg

#define InvokeObjectDropHookArg (   classId,
  objectId,
  subId,
  dropflags 
)
Value:
do { \
RunObjectDropHook((classId),(objectId),(subId), \
(dropflags)); \
} while(0)

Definition at line 182 of file objectaccess.h.

◆ InvokeObjectDropHookArgStr

#define InvokeObjectDropHookArgStr (   classId,
  objectName,
  subId,
  dropflags 
)
Value:
do { \
RunObjectDropHookStr((classId),(objectName),(subId), \
(dropflags)); \
} while(0)

Definition at line 229 of file objectaccess.h.

◆ InvokeObjectDropHookStr

#define InvokeObjectDropHookStr (   classId,
  objectName,
  subId 
)     InvokeObjectDropHookArgStr((classId),(objectName),(subId),0)

Definition at line 227 of file objectaccess.h.

◆ InvokeObjectPostAlterHook

#define InvokeObjectPostAlterHook (   classId,
  objectId,
  subId 
)
Value:
InvokeObjectPostAlterHookArg((classId),(objectId),(subId), \
InvalidOid,false)
#define InvokeObjectPostAlterHookArg(classId, objectId, subId, auxiliaryId, is_internal)
Definition: objectaccess.h:198
#define InvalidOid
Definition: postgres_ext.h:36

Definition at line 195 of file objectaccess.h.

◆ InvokeObjectPostAlterHookArg

#define InvokeObjectPostAlterHookArg (   classId,
  objectId,
  subId,
  auxiliaryId,
  is_internal 
)
Value:
do { \
RunObjectPostAlterHook((classId),(objectId),(subId), \
(auxiliaryId),(is_internal)); \
} while(0)

Definition at line 198 of file objectaccess.h.

◆ InvokeObjectPostAlterHookArgStr

#define InvokeObjectPostAlterHookArgStr (   classId,
  objectName,
  subId,
  auxiliaryId,
  is_internal 
)
Value:
do { \
RunObjectPostAlterHookStr((classId),(objectName),(subId), \
(auxiliaryId),(is_internal)); \
} while(0)

Definition at line 245 of file objectaccess.h.

◆ InvokeObjectPostAlterHookStr

#define InvokeObjectPostAlterHookStr (   classId,
  objectName,
  subId 
)
Value:
InvokeObjectPostAlterHookArgStr((classId),(objectName),(subId), \
InvalidOid,false)
#define InvokeObjectPostAlterHookArgStr(classId, objectName, subId, auxiliaryId, is_internal)
Definition: objectaccess.h:245

Definition at line 242 of file objectaccess.h.

◆ InvokeObjectPostCreateHook

#define InvokeObjectPostCreateHook (   classId,
  objectId,
  subId 
)     InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false)

Definition at line 171 of file objectaccess.h.

◆ InvokeObjectPostCreateHookArg

#define InvokeObjectPostCreateHookArg (   classId,
  objectId,
  subId,
  is_internal 
)
Value:
do { \
RunObjectPostCreateHook((classId),(objectId),(subId), \
(is_internal)); \
} while(0)

Definition at line 173 of file objectaccess.h.

◆ InvokeObjectPostCreateHookArgStr

#define InvokeObjectPostCreateHookArgStr (   classId,
  objectName,
  subId,
  is_internal 
)
Value:
do { \
RunObjectPostCreateHookStr((classId),(objectName),(subId), \
(is_internal)); \
} while(0)

Definition at line 220 of file objectaccess.h.

◆ InvokeObjectPostCreateHookStr

#define InvokeObjectPostCreateHookStr (   classId,
  objectName,
  subId 
)     InvokeObjectPostCreateHookArgStr((classId),(objectName),(subId),false)

Definition at line 218 of file objectaccess.h.

◆ InvokeObjectTruncateHook

#define InvokeObjectTruncateHook (   objectId)
Value:
do { \
RunObjectTruncateHook(objectId); \
} while(0)

Definition at line 189 of file objectaccess.h.

◆ InvokeObjectTruncateHookStr

#define InvokeObjectTruncateHookStr (   objectName)
Value:
do { \
RunObjectTruncateHookStr(objectName); \
} while(0)

Definition at line 236 of file objectaccess.h.

Typedef Documentation

◆ object_access_hook_type

typedef void(* object_access_hook_type) (ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg)

Definition at line 125 of file objectaccess.h.

◆ object_access_hook_type_str

typedef void(* object_access_hook_type_str) (ObjectAccessType access, Oid classId, const char *objectStr, int subId, void *arg)

Definition at line 131 of file objectaccess.h.

◆ ObjectAccessType

Enumeration Type Documentation

◆ ObjectAccessType

Enumerator
OAT_POST_CREATE 
OAT_DROP 
OAT_POST_ALTER 
OAT_NAMESPACE_SEARCH 
OAT_FUNCTION_EXECUTE 
OAT_TRUNCATE 

Definition at line 46 of file objectaccess.h.

47 {
49  OAT_DROP,
ObjectAccessType
Definition: objectaccess.h:47
@ OAT_NAMESPACE_SEARCH
Definition: objectaccess.h:51
@ OAT_FUNCTION_EXECUTE
Definition: objectaccess.h:52
@ OAT_DROP
Definition: objectaccess.h:49
@ OAT_TRUNCATE
Definition: objectaccess.h:53
@ OAT_POST_ALTER
Definition: objectaccess.h:50
@ OAT_POST_CREATE
Definition: objectaccess.h:48

Function Documentation

◆ RunFunctionExecuteHook()

void RunFunctionExecuteHook ( Oid  objectId)

Definition at line 139 of file objectaccess.c.

140 {
141  /* caller should check, but just in case... */
142  Assert(object_access_hook != NULL);
143 
144  (*object_access_hook) (OAT_FUNCTION_EXECUTE,
145  ProcedureRelationId, objectId, 0,
146  NULL);
147 }
Assert(fmt[strlen(fmt) - 1] !='\n')
object_access_hook_type object_access_hook
Definition: objectaccess.c:22

References Assert(), OAT_FUNCTION_EXECUTE, and object_access_hook.

◆ RunFunctionExecuteHookStr()

void RunFunctionExecuteHookStr ( const char *  objectStr)

Definition at line 265 of file objectaccess.c.

266 {
267  /* caller should check, but just in case... */
269 
270  (*object_access_hook_str) (OAT_FUNCTION_EXECUTE,
271  ProcedureRelationId, objectName, 0,
272  NULL);
273 }
object_access_hook_type_str object_access_hook_str
Definition: objectaccess.c:23

References Assert(), OAT_FUNCTION_EXECUTE, and object_access_hook_str.

◆ RunNamespaceSearchHook()

bool RunNamespaceSearchHook ( Oid  objectId,
bool  ereport_on_violation 
)

Definition at line 115 of file objectaccess.c.

116 {
118 
119  /* caller should check, but just in case... */
120  Assert(object_access_hook != NULL);
121 
122  memset(&ns_arg, 0, sizeof(ObjectAccessNamespaceSearch));
123  ns_arg.ereport_on_violation = ereport_on_violation;
124  ns_arg.result = true;
125 
126  (*object_access_hook) (OAT_NAMESPACE_SEARCH,
127  NamespaceRelationId, objectId, 0,
128  (void *) &ns_arg);
129 
130  return ns_arg.result;
131 }

References Assert(), ObjectAccessNamespaceSearch::ereport_on_violation, OAT_NAMESPACE_SEARCH, object_access_hook, and ObjectAccessNamespaceSearch::result.

◆ RunNamespaceSearchHookStr()

bool RunNamespaceSearchHookStr ( const char *  objectStr,
bool  ereport_on_violation 
)

Definition at line 241 of file objectaccess.c.

242 {
244 
245  /* caller should check, but just in case... */
247 
248  memset(&ns_arg, 0, sizeof(ObjectAccessNamespaceSearch));
249  ns_arg.ereport_on_violation = ereport_on_violation;
250  ns_arg.result = true;
251 
252  (*object_access_hook_str) (OAT_NAMESPACE_SEARCH,
253  NamespaceRelationId, objectName, 0,
254  (void *) &ns_arg);
255 
256  return ns_arg.result;
257 }

References Assert(), ObjectAccessNamespaceSearch::ereport_on_violation, OAT_NAMESPACE_SEARCH, object_access_hook_str, and ObjectAccessNamespaceSearch::result.

◆ RunObjectDropHook()

void RunObjectDropHook ( Oid  classId,
Oid  objectId,
int  subId,
int  dropflags 
)

Definition at line 54 of file objectaccess.c.

56 {
57  ObjectAccessDrop drop_arg;
58 
59  /* caller should check, but just in case... */
60  Assert(object_access_hook != NULL);
61 
62  memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
63  drop_arg.dropflags = dropflags;
64 
65  (*object_access_hook) (OAT_DROP,
66  classId, objectId, subId,
67  (void *) &drop_arg);
68 }

References Assert(), ObjectAccessDrop::dropflags, OAT_DROP, and object_access_hook.

◆ RunObjectDropHookStr()

void RunObjectDropHookStr ( Oid  classId,
const char *  objectStr,
int  subId,
int  dropflags 
)

Definition at line 180 of file objectaccess.c.

182 {
183  ObjectAccessDrop drop_arg;
184 
185  /* caller should check, but just in case... */
187 
188  memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
189  drop_arg.dropflags = dropflags;
190 
191  (*object_access_hook_str) (OAT_DROP,
192  classId, objectName, subId,
193  (void *) &drop_arg);
194 }

References Assert(), ObjectAccessDrop::dropflags, OAT_DROP, and object_access_hook_str.

◆ RunObjectPostAlterHook()

void RunObjectPostAlterHook ( Oid  classId,
Oid  objectId,
int  subId,
Oid  auxiliaryId,
bool  is_internal 
)

Definition at line 92 of file objectaccess.c.

94 {
95  ObjectAccessPostAlter pa_arg;
96 
97  /* caller should check, but just in case... */
98  Assert(object_access_hook != NULL);
99 
100  memset(&pa_arg, 0, sizeof(ObjectAccessPostAlter));
101  pa_arg.auxiliary_id = auxiliaryId;
102  pa_arg.is_internal = is_internal;
103 
104  (*object_access_hook) (OAT_POST_ALTER,
105  classId, objectId, subId,
106  (void *) &pa_arg);
107 }

References Assert(), ObjectAccessPostAlter::auxiliary_id, ObjectAccessPostAlter::is_internal, OAT_POST_ALTER, and object_access_hook.

◆ RunObjectPostAlterHookStr()

void RunObjectPostAlterHookStr ( Oid  classId,
const char *  objectStr,
int  subId,
Oid  auxiliaryId,
bool  is_internal 
)

Definition at line 218 of file objectaccess.c.

220 {
221  ObjectAccessPostAlter pa_arg;
222 
223  /* caller should check, but just in case... */
225 
226  memset(&pa_arg, 0, sizeof(ObjectAccessPostAlter));
227  pa_arg.auxiliary_id = auxiliaryId;
228  pa_arg.is_internal = is_internal;
229 
230  (*object_access_hook_str) (OAT_POST_ALTER,
231  classId, objectName, subId,
232  (void *) &pa_arg);
233 }

References Assert(), ObjectAccessPostAlter::auxiliary_id, ObjectAccessPostAlter::is_internal, OAT_POST_ALTER, and object_access_hook_str.

◆ RunObjectPostCreateHook()

void RunObjectPostCreateHook ( Oid  classId,
Oid  objectId,
int  subId,
bool  is_internal 
)

Definition at line 32 of file objectaccess.c.

34 {
36 
37  /* caller should check, but just in case... */
38  Assert(object_access_hook != NULL);
39 
40  memset(&pc_arg, 0, sizeof(ObjectAccessPostCreate));
41  pc_arg.is_internal = is_internal;
42 
43  (*object_access_hook) (OAT_POST_CREATE,
44  classId, objectId, subId,
45  (void *) &pc_arg);
46 }

References Assert(), ObjectAccessPostCreate::is_internal, OAT_POST_CREATE, and object_access_hook.

◆ RunObjectPostCreateHookStr()

void RunObjectPostCreateHookStr ( Oid  classId,
const char *  objectStr,
int  subId,
bool  is_internal 
)

Definition at line 158 of file objectaccess.c.

160 {
161  ObjectAccessPostCreate pc_arg;
162 
163  /* caller should check, but just in case... */
165 
166  memset(&pc_arg, 0, sizeof(ObjectAccessPostCreate));
167  pc_arg.is_internal = is_internal;
168 
169  (*object_access_hook_str) (OAT_POST_CREATE,
170  classId, objectName, subId,
171  (void *) &pc_arg);
172 }

References Assert(), ObjectAccessPostCreate::is_internal, OAT_POST_CREATE, and object_access_hook_str.

◆ RunObjectTruncateHook()

void RunObjectTruncateHook ( Oid  objectId)

Definition at line 76 of file objectaccess.c.

77 {
78  /* caller should check, but just in case... */
79  Assert(object_access_hook != NULL);
80 
81  (*object_access_hook) (OAT_TRUNCATE,
82  RelationRelationId, objectId, 0,
83  NULL);
84 }

References Assert(), OAT_TRUNCATE, and object_access_hook.

◆ RunObjectTruncateHookStr()

void RunObjectTruncateHookStr ( const char *  objectStr)

Definition at line 202 of file objectaccess.c.

203 {
204  /* caller should check, but just in case... */
206 
207  (*object_access_hook_str) (OAT_TRUNCATE,
208  RelationRelationId, objectName, 0,
209  NULL);
210 }

References Assert(), OAT_TRUNCATE, and object_access_hook_str.

Variable Documentation

◆ object_access_hook

◆ object_access_hook_str