PostgreSQL Source Code  git master
objectaccess.c File Reference
#include "postgres.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_class.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_proc.h"
Include dependency graph for objectaccess.c:

Go to the source code of this file.

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 *objectName, int subId, bool is_internal)
 
void RunObjectDropHookStr (Oid classId, const char *objectName, int subId, int dropflags)
 
void RunObjectTruncateHookStr (const char *objectName)
 
void RunObjectPostAlterHookStr (Oid classId, const char *objectName, int subId, Oid auxiliaryId, bool is_internal)
 
bool RunNamespaceSearchHookStr (const char *objectName, bool ereport_on_violation)
 
void RunFunctionExecuteHookStr (const char *objectName)
 

Variables

object_access_hook_type object_access_hook = NULL
 
object_access_hook_type_str object_access_hook_str = NULL
 

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 }
#define Assert(condition)
Definition: c.h:858
object_access_hook_type object_access_hook
Definition: objectaccess.c:22
@ OAT_FUNCTION_EXECUTE
Definition: objectaccess.h:54

References Assert, OAT_FUNCTION_EXECUTE, and object_access_hook.

◆ RunFunctionExecuteHookStr()

void RunFunctionExecuteHookStr ( const char *  objectName)

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 }
@ OAT_NAMESPACE_SEARCH
Definition: objectaccess.h:53

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

◆ RunNamespaceSearchHookStr()

bool RunNamespaceSearchHookStr ( const char *  objectName,
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 }
@ OAT_DROP
Definition: objectaccess.h:51

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

◆ RunObjectDropHookStr()

void RunObjectDropHookStr ( Oid  classId,
const char *  objectName,
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 }
@ OAT_POST_ALTER
Definition: objectaccess.h:52

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

◆ RunObjectPostAlterHookStr()

void RunObjectPostAlterHookStr ( Oid  classId,
const char *  objectName,
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 }
@ OAT_POST_CREATE
Definition: objectaccess.h:50

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

◆ RunObjectPostCreateHookStr()

void RunObjectPostCreateHookStr ( Oid  classId,
const char *  objectName,
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 }
@ OAT_TRUNCATE
Definition: objectaccess.h:55

References Assert, OAT_TRUNCATE, and object_access_hook.

◆ RunObjectTruncateHookStr()

void RunObjectTruncateHookStr ( const char *  objectName)

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