Code beautification for object-access hook machinery.

KaiGai Kohei
This commit is contained in:
Robert Haas 2013-03-06 20:52:06 -05:00
parent f11af2bcab
commit f90cc26982
29 changed files with 123 additions and 119 deletions

View File

@ -11,7 +11,8 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
OBJS = catalog.o dependency.o heap.o index.o indexing.o namespace.o aclchk.o \ OBJS = catalog.o dependency.o heap.o index.o indexing.o namespace.o aclchk.o \
objectaddress.o pg_aggregate.o pg_collation.o pg_constraint.o pg_conversion.o \ objectaccess.o objectaddress.o pg_aggregate.o pg_collation.o \
pg_constraint.o pg_conversion.o \
pg_depend.o pg_enum.o pg_inherits.o pg_largeobject.o pg_namespace.o \ pg_depend.o pg_enum.o pg_inherits.o pg_largeobject.o pg_namespace.o \
pg_operator.o pg_proc.o pg_range.o pg_db_role_setting.o pg_shdepend.o \ pg_operator.o pg_proc.o pg_range.o pg_db_role_setting.o pg_shdepend.o \
pg_type.o storage.o toasting.o pg_type.o storage.o toasting.o

View File

@ -997,14 +997,8 @@ deleteOneObject(const ObjectAddress *object, Relation *depRel, int flags)
HeapTuple tup; HeapTuple tup;
/* DROP hook of the objects being removed */ /* DROP hook of the objects being removed */
if (object_access_hook) InvokeObjectDropHookArg(object->classId, object->objectId,
{ object->objectSubId, flags);
ObjectAccessDrop drop_arg;
drop_arg.dropflags = flags;
InvokeObjectAccessHook(OAT_DROP, object->classId, object->objectId,
object->objectSubId, &drop_arg);
}
/* /*
* Close depRel if we are doing a drop concurrently. The object deletion * Close depRel if we are doing a drop concurrently. The object deletion

View File

@ -1293,15 +1293,7 @@ heap_create_with_catalog(const char *relname,
} }
/* Post creation hook for new relation */ /* Post creation hook for new relation */
if (object_access_hook) InvokeObjectPostCreateHookArg(RelationRelationId, relid, 0, is_internal);
{
ObjectAccessPostCreate post_create_args;
memset(&post_create_args, 0, sizeof(ObjectAccessPostCreate));
post_create_args.is_internal = is_internal;
(*object_access_hook)(OAT_POST_CREATE, RelationRelationId,
relid, 0, &post_create_args);
}
/* /*
* Store any supplied constraints and defaults. * Store any supplied constraints and defaults.

View File

@ -1028,15 +1028,8 @@ index_create(Relation heapRelation,
} }
/* Post creation hook for new index */ /* Post creation hook for new index */
if (object_access_hook) InvokeObjectPostCreateHookArg(RelationRelationId,
{ indexRelationId, 0, is_internal);
ObjectAccessPostCreate post_create_args;
memset(&post_create_args, 0, sizeof(ObjectAccessPostCreate));
post_create_args.is_internal = is_internal;
(*object_access_hook)(OAT_POST_CREATE, RelationRelationId,
indexRelationId, 0, &post_create_args);
}
/* /*
* Advance the command counter so that we can see the newly-entered * Advance the command counter so that we can see the newly-entered

View File

@ -0,0 +1,63 @@
/* -------------------------------------------------------------------------
*
* objectaccess.c
* functions for object_access_hook on various events
*
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* -------------------------------------------------------------------------
*/
#include "postgres.h"
#include "catalog/objectaccess.h"
/*
* Hook on object accesses. This is intended as infrastructure for security
* and logging plugins.
*/
object_access_hook_type object_access_hook = NULL;
/*
* RunObjectPostCreateHook
*
* It is entrypoint of OAT_POST_CREATE event
*/
void
RunObjectPostCreateHook(Oid classId, Oid objectId, int subId,
bool is_internal)
{
ObjectAccessPostCreate pc_arg;
/* caller should check, but just in case... */
Assert(object_access_hook != NULL);
memset(&pc_arg, 0, sizeof(ObjectAccessPostCreate));
pc_arg.is_internal = is_internal;
(*object_access_hook)(OAT_POST_CREATE,
classId, objectId, subId,
(void *) &pc_arg);
}
/*
* RunObjectDropHook
*
* It is entrypoint of OAT_DROP event
*/
void
RunObjectDropHook(Oid classId, Oid objectId, int subId,
int dropflags)
{
ObjectAccessDrop drop_arg;
/* caller should check, but just in case... */
Assert(object_access_hook != NULL);
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
drop_arg.dropflags = dropflags;
(*object_access_hook)(OAT_DROP,
classId, objectId, subId,
(void *) &drop_arg);
}

View File

@ -136,8 +136,7 @@ CollationCreate(const char *collname, Oid collnamespace,
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new collation */ /* Post creation hook for new collation */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(CollationRelationId, oid, 0);
CollationRelationId, oid, 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -367,8 +367,7 @@ CreateConstraintEntry(const char *constraintName,
} }
/* Post creation hook for new constraint */ /* Post creation hook for new constraint */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(ConstraintRelationId, conOid, 0);
ConstraintRelationId, conOid, 0, NULL);
return conOid; return conOid;
} }

View File

@ -136,8 +136,7 @@ ConversionCreate(const char *conname, Oid connamespace,
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new conversion */ /* Post creation hook for new conversion */
InvokeObjectAccessHook(OAT_POST_CREATE, ConversionRelationId, InvokeObjectPostCreateHook(ConversionRelationId, HeapTupleGetOid(tup), 0);
HeapTupleGetOid(tup), 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -96,8 +96,7 @@ NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new schema */ /* Post creation hook for new schema */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(NamespaceRelationId, nspoid, 0);
NamespaceRelationId, nspoid, 0, NULL);
return nspoid; return nspoid;
} }

View File

@ -275,8 +275,7 @@ OperatorShellMake(const char *operatorName,
heap_freetuple(tup); heap_freetuple(tup);
/* Post creation hook for new shell operator */ /* Post creation hook for new shell operator */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
OperatorRelationId, operatorObjectId, 0, NULL);
/* /*
* Make sure the tuple is visible for subsequent lookups/updates. * Make sure the tuple is visible for subsequent lookups/updates.
@ -544,8 +543,7 @@ OperatorCreate(const char *operatorName,
makeOperatorDependencies(tup); makeOperatorDependencies(tup);
/* Post creation hook for new operator */ /* Post creation hook for new operator */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
OperatorRelationId, operatorObjectId, 0, NULL);
heap_close(pg_operator_desc, RowExclusiveLock); heap_close(pg_operator_desc, RowExclusiveLock);

View File

@ -661,8 +661,7 @@ ProcedureCreate(const char *procedureName,
heap_freetuple(tup); heap_freetuple(tup);
/* Post creation hook for new function */ /* Post creation hook for new function */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(ProcedureRelationId, retval, 0);
ProcedureRelationId, retval, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -163,8 +163,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
false); false);
/* Post creation hook for new shell type */ /* Post creation hook for new shell type */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TypeRelationId, typoid, 0);
TypeRelationId, typoid, 0, NULL);
/* /*
* clean up and return the type-oid * clean up and return the type-oid
@ -476,8 +475,7 @@ TypeCreate(Oid newTypeOid,
rebuildDeps); rebuildDeps);
/* Post creation hook for new type */ /* Post creation hook for new type */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TypeRelationId, typeObjectId, 0);
TypeRelationId, typeObjectId, 0, NULL);
/* /*
* finish up * finish up

View File

@ -29,6 +29,7 @@
#include "catalog/pg_aggregate.h" #include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h" #include "catalog/pg_proc.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "commands/alter.h"
#include "commands/defrem.h" #include "commands/defrem.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "parser/parse_func.h" #include "parser/parse_func.h"

View File

@ -524,8 +524,7 @@ createdb(const CreatedbStmt *stmt)
copyTemplateDependencies(src_dboid, dboid); copyTemplateDependencies(src_dboid, dboid);
/* Post creation hook for new database */ /* Post creation hook for new database */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(DatabaseRelationId, dboid, 0);
DatabaseRelationId, dboid, 0, NULL);
/* /*
* Force a checkpoint before starting the copy. This will force dirty * Force a checkpoint before starting the copy. This will force dirty
@ -816,14 +815,7 @@ dropdb(const char *dbname, bool missing_ok)
dbname); dbname);
/* DROP hook for the database being removed */ /* DROP hook for the database being removed */
if (object_access_hook) InvokeObjectDropHook(DatabaseRelationId, db_id, 0);
{
ObjectAccessDrop drop_arg;
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
InvokeObjectAccessHook(OAT_DROP,
DatabaseRelationId, db_id, 0, &drop_arg);
}
/* /*
* Disallow dropping a DB that is marked istemplate. This is just to * Disallow dropping a DB that is marked istemplate. This is just to

View File

@ -310,8 +310,7 @@ insert_event_trigger_tuple(char *trigname, char *eventname, Oid evtOwner,
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
/* Post creation hook for new operator family */ /* Post creation hook for new operator family */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(EventTriggerRelationId, trigoid, 0);
EventTriggerRelationId, trigoid, 0, NULL);
/* Close pg_event_trigger. */ /* Close pg_event_trigger. */
heap_close(tgrel, RowExclusiveLock); heap_close(tgrel, RowExclusiveLock);

View File

@ -1562,8 +1562,7 @@ InsertExtensionTuple(const char *extName, Oid extOwner,
recordDependencyOn(&myself, &otherext, DEPENDENCY_NORMAL); recordDependencyOn(&myself, &otherext, DEPENDENCY_NORMAL);
} }
/* Post creation hook for new extension */ /* Post creation hook for new extension */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(ExtensionRelationId, extensionOid, 0);
ExtensionRelationId, extensionOid, 0, NULL);
return extensionOid; return extensionOid;
} }

View File

@ -599,8 +599,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new foreign data wrapper */ /* Post creation hook for new foreign data wrapper */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(ForeignDataWrapperRelationId, fdwId, 0);
ForeignDataWrapperRelationId, fdwId, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
@ -900,8 +899,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new foreign server */ /* Post creation hook for new foreign server */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(ForeignServerRelationId, srvId, 0);
ForeignServerRelationId, srvId, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
@ -1145,8 +1143,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new user mapping */ /* Post creation hook for new user mapping */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(UserMappingRelationId, umId, 0);
UserMappingRelationId, umId, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -1558,8 +1558,7 @@ CreateCast(CreateCastStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new cast */ /* Post creation hook for new cast */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(CastRelationId, castid, 0);
CastRelationId, castid, 0, NULL);
heap_freetuple(tuple); heap_freetuple(tuple);

View File

@ -309,8 +309,7 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new operator family */ /* Post creation hook for new operator family */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(OperatorFamilyRelationId, opfamilyoid, 0);
OperatorFamilyRelationId, opfamilyoid, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);
@ -710,8 +709,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
/* Post creation hook for new operator class */ /* Post creation hook for new operator class */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(OperatorClassRelationId, opclassoid, 0);
OperatorClassRelationId, opclassoid, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -429,8 +429,7 @@ create_proc_lang(const char *languageName, bool replace,
} }
/* Post creation hook for new procedural language */ /* Post creation hook for new procedural language */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(LanguageRelationId, myself.objectId, 0);
LanguageRelationId, myself.objectId, 0, NULL);
heap_close(rel, RowExclusiveLock); heap_close(rel, RowExclusiveLock);

View File

@ -4514,8 +4514,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
heap_freetuple(reltup); heap_freetuple(reltup);
/* Post creation hook for new attribute */ /* Post creation hook for new attribute */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(RelationRelationId, myrelid, newattnum);
RelationRelationId, myrelid, newattnum, NULL);
heap_close(pgclass, RowExclusiveLock); heap_close(pgclass, RowExclusiveLock);

View File

@ -331,8 +331,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
recordDependencyOnOwner(TableSpaceRelationId, tablespaceoid, ownerId); recordDependencyOnOwner(TableSpaceRelationId, tablespaceoid, ownerId);
/* Post creation hook for new tablespace */ /* Post creation hook for new tablespace */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TableSpaceRelationId, tablespaceoid, 0);
TableSpaceRelationId, tablespaceoid, 0, NULL);
create_tablespace_directories(location, tablespaceoid); create_tablespace_directories(location, tablespaceoid);
@ -439,14 +438,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
tablespacename); tablespacename);
/* DROP hook for the tablespace being removed */ /* DROP hook for the tablespace being removed */
if (object_access_hook) InvokeObjectDropHook(TableSpaceRelationId, tablespaceoid, 0);
{
ObjectAccessDrop drop_arg;
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
InvokeObjectAccessHook(OAT_DROP, TableSpaceRelationId,
tablespaceoid, 0, &drop_arg);
}
/* /*
* Remove the pg_tablespace tuple (this will roll back if we fail below) * Remove the pg_tablespace tuple (this will roll back if we fail below)

View File

@ -742,8 +742,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
DEPENDENCY_NORMAL); DEPENDENCY_NORMAL);
/* Post creation hook for new trigger */ /* Post creation hook for new trigger */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TriggerRelationId, trigoid, 0);
TriggerRelationId, trigoid, 0, NULL);
/* Keep lock on target rel until end of xact */ /* Keep lock on target rel until end of xact */
heap_close(rel, NoLock); heap_close(rel, NoLock);

View File

@ -272,8 +272,7 @@ DefineTSParser(List *names, List *parameters)
makeParserDependencies(tup); makeParserDependencies(tup);
/* Post creation hook for new text search parser */ /* Post creation hook for new text search parser */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TSParserRelationId, prsOid, 0);
TSParserRelationId, prsOid, 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);
@ -479,8 +478,7 @@ DefineTSDictionary(List *names, List *parameters)
makeDictionaryDependencies(tup); makeDictionaryDependencies(tup);
/* Post creation hook for new text search dictionary */ /* Post creation hook for new text search dictionary */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TSDictionaryRelationId, dictOid, 0);
TSDictionaryRelationId, dictOid, 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);
@ -796,8 +794,7 @@ DefineTSTemplate(List *names, List *parameters)
makeTSTemplateDependencies(tup); makeTSTemplateDependencies(tup);
/* Post creation hook for new text search template */ /* Post creation hook for new text search template */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TSTemplateRelationId, tmplOid, 0);
TSTemplateRelationId, tmplOid, 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);
@ -1092,8 +1089,7 @@ DefineTSConfiguration(List *names, List *parameters)
makeConfigurationDependencies(tup, false, mapRel); makeConfigurationDependencies(tup, false, mapRel);
/* Post creation hook for new text search configuration */ /* Post creation hook for new text search configuration */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(TSConfigRelationId, cfgOid, 0);
TSConfigRelationId, cfgOid, 0, NULL);
heap_freetuple(tup); heap_freetuple(tup);

View File

@ -426,8 +426,7 @@ CreateRole(CreateRoleStmt *stmt)
GetUserId(), false); GetUserId(), false);
/* Post creation hook for new role */ /* Post creation hook for new role */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(AuthIdRelationId, roleid, 0);
AuthIdRelationId, roleid, 0, NULL);
/* /*
* Close pg_authid, but keep lock till commit. * Close pg_authid, but keep lock till commit.
@ -968,14 +967,7 @@ DropRole(DropRoleStmt *stmt)
errmsg("must be superuser to drop superusers"))); errmsg("must be superuser to drop superusers")));
/* DROP hook for the role being removed */ /* DROP hook for the role being removed */
if (object_access_hook) InvokeObjectDropHook(AuthIdRelationId, roleid, 0);
{
ObjectAccessDrop drop_arg;
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
InvokeObjectAccessHook(OAT_DROP,
AuthIdRelationId, roleid, 0, &drop_arg);
}
/* /*
* Lock the role, so nobody can add dependencies to her while we drop * Lock the role, so nobody can add dependencies to her while we drop

View File

@ -182,8 +182,7 @@ InsertRule(char *rulname,
} }
/* Post creation hook for new rule */ /* Post creation hook for new rule */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(RewriteRelationId, rewriteObjectId, 0);
RewriteRelationId, rewriteObjectId, 0, NULL);
heap_close(pg_rewrite_desc, RowExclusiveLock); heap_close(pg_rewrite_desc, RowExclusiveLock);

View File

@ -218,8 +218,7 @@ inv_create(Oid lobjId)
lobjId_new, GetUserId()); lobjId_new, GetUserId());
/* Post creation hook for new large object */ /* Post creation hook for new large object */
InvokeObjectAccessHook(OAT_POST_CREATE, InvokeObjectPostCreateHook(LargeObjectRelationId, lobjId_new, 0);
LargeObjectRelationId, lobjId_new, 0, NULL);
/* /*
* Advance command counter to make new tuple visible to later operations. * Advance command counter to make new tuple visible to later operations.

View File

@ -18,7 +18,6 @@
*/ */
#include "postgres.h" #include "postgres.h"
#include "catalog/objectaccess.h"
#include "libpq/pqcomm.h" #include "libpq/pqcomm.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "storage/backendid.h" #include "storage/backendid.h"
@ -126,9 +125,3 @@ int VacuumCostBalance = 0; /* working state for vacuum */
bool VacuumCostActive = false; bool VacuumCostActive = false;
int GinFuzzySearchLimit = 0; int GinFuzzySearchLimit = 0;
/*
* Hook on object accesses. This is intended as infrastructure for security
* and logging plugins.
*/
object_access_hook_type object_access_hook = NULL;

View File

@ -28,6 +28,7 @@ typedef enum ObjectAccessType
{ {
OAT_POST_CREATE, OAT_POST_CREATE,
OAT_DROP, OAT_DROP,
OAT_POST_ALTER,
} ObjectAccessType; } ObjectAccessType;
/* /*
@ -66,11 +67,27 @@ typedef void (*object_access_hook_type) (ObjectAccessType access,
extern PGDLLIMPORT object_access_hook_type object_access_hook; extern PGDLLIMPORT object_access_hook_type object_access_hook;
#define InvokeObjectAccessHook(access,classId,objectId,subId,arg) \ extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId,
bool is_internal);
extern void RunObjectDropHook(Oid classId, Oid objectId, int subId,
int dropflags);
#define InvokeObjectPostCreateHook(classId,objectId,subId) \
InvokeObjectPostCreateHookArg((classId),(objectId),(subId),false)
#define InvokeObjectPostCreateHookArg(classId,objectId,subId,is_internal) \
do { \ do { \
if (object_access_hook) \ if (object_access_hook) \
(*object_access_hook)((access),(classId), \ RunObjectPostCreateHook((classId),(objectId),(subId), \
(objectId),(subId),(arg)); \ (is_internal)); \
} while(0)
#define InvokeObjectDropHook(classId,objectId,subId) \
InvokeObjectDropHookArg((classId),(objectId),(subId),0)
#define InvokeObjectDropHookArg(classId,objectId,subId,dropflags) \
do { \
if (object_access_hook) \
RunObjectDropHook((classId),(objectId),(subId), \
(dropflags)); \
} while(0) } while(0)
#endif /* OBJECTACCESS_H */ #endif /* OBJECTACCESS_H */