1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-14 02:22:38 +03:00

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

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

View File

@@ -524,8 +524,7 @@ createdb(const CreatedbStmt *stmt)
copyTemplateDependencies(src_dboid, dboid);
/* Post creation hook for new database */
InvokeObjectAccessHook(OAT_POST_CREATE,
DatabaseRelationId, dboid, 0, NULL);
InvokeObjectPostCreateHook(DatabaseRelationId, dboid, 0);
/*
* Force a checkpoint before starting the copy. This will force dirty
@@ -816,14 +815,7 @@ dropdb(const char *dbname, bool missing_ok)
dbname);
/* DROP hook for the database being removed */
if (object_access_hook)
{
ObjectAccessDrop drop_arg;
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
InvokeObjectAccessHook(OAT_DROP,
DatabaseRelationId, db_id, 0, &drop_arg);
}
InvokeObjectDropHook(DatabaseRelationId, db_id, 0);
/*
* 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);
/* Post creation hook for new operator family */
InvokeObjectAccessHook(OAT_POST_CREATE,
EventTriggerRelationId, trigoid, 0, NULL);
InvokeObjectPostCreateHook(EventTriggerRelationId, trigoid, 0);
/* Close pg_event_trigger. */
heap_close(tgrel, RowExclusiveLock);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -331,8 +331,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
recordDependencyOnOwner(TableSpaceRelationId, tablespaceoid, ownerId);
/* Post creation hook for new tablespace */
InvokeObjectAccessHook(OAT_POST_CREATE,
TableSpaceRelationId, tablespaceoid, 0, NULL);
InvokeObjectPostCreateHook(TableSpaceRelationId, tablespaceoid, 0);
create_tablespace_directories(location, tablespaceoid);
@@ -439,14 +438,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
tablespacename);
/* DROP hook for the tablespace being removed */
if (object_access_hook)
{
ObjectAccessDrop drop_arg;
memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
InvokeObjectAccessHook(OAT_DROP, TableSpaceRelationId,
tablespaceoid, 0, &drop_arg);
}
InvokeObjectDropHook(TableSpaceRelationId, tablespaceoid, 0);
/*
* 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);
/* Post creation hook for new trigger */
InvokeObjectAccessHook(OAT_POST_CREATE,
TriggerRelationId, trigoid, 0, NULL);
InvokeObjectPostCreateHook(TriggerRelationId, trigoid, 0);
/* Keep lock on target rel until end of xact */
heap_close(rel, NoLock);

View File

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

View File

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