Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "postgres.h"
00012
00013 #include "catalog/objectaccess.h"
00014 #include "catalog/pg_namespace.h"
00015 #include "catalog/pg_proc.h"
00016
00017
00018
00019
00020
00021 object_access_hook_type object_access_hook = NULL;
00022
00023
00024
00025
00026
00027
00028 void
00029 RunObjectPostCreateHook(Oid classId, Oid objectId, int subId,
00030 bool is_internal)
00031 {
00032 ObjectAccessPostCreate pc_arg;
00033
00034
00035 Assert(object_access_hook != NULL);
00036
00037 memset(&pc_arg, 0, sizeof(ObjectAccessPostCreate));
00038 pc_arg.is_internal = is_internal;
00039
00040 (*object_access_hook)(OAT_POST_CREATE,
00041 classId, objectId, subId,
00042 (void *) &pc_arg);
00043 }
00044
00045
00046
00047
00048
00049
00050 void
00051 RunObjectDropHook(Oid classId, Oid objectId, int subId,
00052 int dropflags)
00053 {
00054 ObjectAccessDrop drop_arg;
00055
00056
00057 Assert(object_access_hook != NULL);
00058
00059 memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
00060 drop_arg.dropflags = dropflags;
00061
00062 (*object_access_hook)(OAT_DROP,
00063 classId, objectId, subId,
00064 (void *) &drop_arg);
00065 }
00066
00067
00068
00069
00070
00071
00072 void
00073 RunObjectPostAlterHook(Oid classId, Oid objectId, int subId,
00074 Oid auxiliaryId, bool is_internal)
00075 {
00076 ObjectAccessPostAlter pa_arg;
00077
00078
00079 Assert(object_access_hook != NULL);
00080
00081 memset(&pa_arg, 0, sizeof(ObjectAccessPostAlter));
00082 pa_arg.auxiliary_id = auxiliaryId;
00083 pa_arg.is_internal = is_internal;
00084
00085 (*object_access_hook)(OAT_POST_ALTER,
00086 classId, objectId, subId,
00087 (void *) &pa_arg);
00088 }
00089
00090
00091
00092
00093
00094
00095 bool
00096 RunNamespaceSearchHook(Oid objectId, bool ereport_on_violation)
00097 {
00098 ObjectAccessNamespaceSearch ns_arg;
00099
00100
00101 Assert(object_access_hook != NULL);
00102
00103 memset(&ns_arg, 0, sizeof(ObjectAccessNamespaceSearch));
00104 ns_arg.ereport_on_violation = ereport_on_violation;
00105 ns_arg.result = true;
00106
00107 (*object_access_hook)(OAT_NAMESPACE_SEARCH,
00108 NamespaceRelationId, objectId, 0,
00109 (void *) &ns_arg);
00110
00111 return ns_arg.result;
00112 }
00113
00114
00115
00116
00117
00118
00119 void
00120 RunFunctionExecuteHook(Oid objectId)
00121 {
00122
00123 Assert(object_access_hook != NULL);
00124
00125 (*object_access_hook)(OAT_FUNCTION_EXECUTE,
00126 ProcedureRelationId, objectId, 0,
00127 NULL);
00128 }