20
20
* and logging plugins.
21
21
*/
22
22
object_access_hook_type object_access_hook = NULL ;
23
+ object_access_hook_type_str object_access_hook_str = NULL ;
24
+
23
25
24
26
/*
25
27
* RunObjectPostCreateHook
26
28
*
27
- * It is entrypoint of OAT_POST_CREATE event
29
+ * OAT_POST_CREATE object ID based event hook entrypoint
28
30
*/
29
31
void
30
32
RunObjectPostCreateHook (Oid classId , Oid objectId , int subId ,
@@ -46,7 +48,7 @@ RunObjectPostCreateHook(Oid classId, Oid objectId, int subId,
46
48
/*
47
49
* RunObjectDropHook
48
50
*
49
- * It is entrypoint of OAT_DROP event
51
+ * OAT_DROP object ID based event hook entrypoint
50
52
*/
51
53
void
52
54
RunObjectDropHook (Oid classId , Oid objectId , int subId ,
@@ -68,7 +70,7 @@ RunObjectDropHook(Oid classId, Oid objectId, int subId,
68
70
/*
69
71
* RunObjectTruncateHook
70
72
*
71
- * It is the entrypoint of OAT_TRUNCATE event
73
+ * OAT_TRUNCATE object ID based event hook entrypoint
72
74
*/
73
75
void
74
76
RunObjectTruncateHook (Oid objectId )
@@ -84,7 +86,7 @@ RunObjectTruncateHook(Oid objectId)
84
86
/*
85
87
* RunObjectPostAlterHook
86
88
*
87
- * It is entrypoint of OAT_POST_ALTER event
89
+ * OAT_POST_ALTER object ID based event hook entrypoint
88
90
*/
89
91
void
90
92
RunObjectPostAlterHook (Oid classId , Oid objectId , int subId ,
@@ -107,7 +109,7 @@ RunObjectPostAlterHook(Oid classId, Oid objectId, int subId,
107
109
/*
108
110
* RunNamespaceSearchHook
109
111
*
110
- * It is entrypoint of OAT_NAMESPACE_SEARCH event
112
+ * OAT_NAMESPACE_SEARCH object ID based event hook entrypoint
111
113
*/
112
114
bool
113
115
RunNamespaceSearchHook (Oid objectId , bool ereport_on_violation )
@@ -131,7 +133,7 @@ RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation)
131
133
/*
132
134
* RunFunctionExecuteHook
133
135
*
134
- * It is entrypoint of OAT_FUNCTION_EXECUTE event
136
+ * OAT_FUNCTION_EXECUTE object ID based event hook entrypoint
135
137
*/
136
138
void
137
139
RunFunctionExecuteHook (Oid objectId )
@@ -143,3 +145,129 @@ RunFunctionExecuteHook(Oid objectId)
143
145
ProcedureRelationId , objectId , 0 ,
144
146
NULL );
145
147
}
148
+
149
+ /* String versions */
150
+
151
+
152
+ /*
153
+ * RunObjectPostCreateHookStr
154
+ *
155
+ * OAT_POST_CREATE object name based event hook entrypoint
156
+ */
157
+ void
158
+ RunObjectPostCreateHookStr (Oid classId , const char * objectName , int subId ,
159
+ bool is_internal )
160
+ {
161
+ ObjectAccessPostCreate pc_arg ;
162
+
163
+ /* caller should check, but just in case... */
164
+ Assert (object_access_hook_str != NULL );
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
+ }
173
+
174
+ /*
175
+ * RunObjectDropHookStr
176
+ *
177
+ * OAT_DROP object name based event hook entrypoint
178
+ */
179
+ void
180
+ RunObjectDropHookStr (Oid classId , const char * objectName , int subId ,
181
+ int dropflags )
182
+ {
183
+ ObjectAccessDrop drop_arg ;
184
+
185
+ /* caller should check, but just in case... */
186
+ Assert (object_access_hook_str != NULL );
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
+ }
195
+
196
+ /*
197
+ * RunObjectTruncateHookStr
198
+ *
199
+ * OAT_TRUNCATE object name based event hook entrypoint
200
+ */
201
+ void
202
+ RunObjectTruncateHookStr (const char * objectName )
203
+ {
204
+ /* caller should check, but just in case... */
205
+ Assert (object_access_hook_str != NULL );
206
+
207
+ (* object_access_hook_str ) (OAT_TRUNCATE ,
208
+ RelationRelationId , objectName , 0 ,
209
+ NULL );
210
+ }
211
+
212
+ /*
213
+ * RunObjectPostAlterHookStr
214
+ *
215
+ * OAT_POST_ALTER object name based event hook entrypoint
216
+ */
217
+ void
218
+ RunObjectPostAlterHookStr (Oid classId , const char * objectName , int subId ,
219
+ Oid auxiliaryId , bool is_internal )
220
+ {
221
+ ObjectAccessPostAlter pa_arg ;
222
+
223
+ /* caller should check, but just in case... */
224
+ Assert (object_access_hook_str != NULL );
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
+ }
234
+
235
+ /*
236
+ * RunNamespaceSearchHookStr
237
+ *
238
+ * OAT_NAMESPACE_SEARCH object name based event hook entrypoint
239
+ */
240
+ bool
241
+ RunNamespaceSearchHookStr (const char * objectName , bool ereport_on_violation )
242
+ {
243
+ ObjectAccessNamespaceSearch ns_arg ;
244
+
245
+ /* caller should check, but just in case... */
246
+ Assert (object_access_hook_str != NULL );
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
+ }
258
+
259
+ /*
260
+ * RunFunctionExecuteHookStr
261
+ *
262
+ * OAT_FUNCTION_EXECUTE object name based event hook entrypoint
263
+ */
264
+ void
265
+ RunFunctionExecuteHookStr (const char * objectName )
266
+ {
267
+ /* caller should check, but just in case... */
268
+ Assert (object_access_hook_str != NULL );
269
+
270
+ (* object_access_hook_str ) (OAT_FUNCTION_EXECUTE ,
271
+ ProcedureRelationId , objectName , 0 ,
272
+ NULL );
273
+ }
0 commit comments