mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Replace uses of heap_open et al with the corresponding table_* function.
Author: Andres Freund Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
This commit is contained in:
@ -284,7 +284,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
|
||||
Form_pg_foreign_data_wrapper form;
|
||||
|
||||
|
||||
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
|
||||
|
||||
@ -302,7 +302,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -318,7 +318,7 @@ AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
|
||||
HeapTuple tup;
|
||||
Relation rel;
|
||||
|
||||
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fwdId));
|
||||
|
||||
@ -331,7 +331,7 @@ AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -423,7 +423,7 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
|
||||
ObjectAddress address;
|
||||
Form_pg_foreign_server form;
|
||||
|
||||
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCacheCopy1(FOREIGNSERVERNAME, CStringGetDatum(name));
|
||||
|
||||
@ -441,7 +441,7 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -455,7 +455,7 @@ AlterForeignServerOwner_oid(Oid srvId, Oid newOwnerId)
|
||||
HeapTuple tup;
|
||||
Relation rel;
|
||||
|
||||
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCacheCopy1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
|
||||
|
||||
@ -468,7 +468,7 @@ AlterForeignServerOwner_oid(Oid srvId, Oid newOwnerId)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -579,7 +579,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
|
||||
ObjectAddress myself;
|
||||
ObjectAddress referenced;
|
||||
|
||||
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
|
||||
/* Must be super user */
|
||||
if (!superuser())
|
||||
@ -669,7 +669,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
|
||||
/* Post creation hook for new foreign data wrapper */
|
||||
InvokeObjectPostCreateHook(ForeignDataWrapperRelationId, fdwId, 0);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return myself;
|
||||
}
|
||||
@ -696,7 +696,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
|
||||
Oid fdwvalidator;
|
||||
ObjectAddress myself;
|
||||
|
||||
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
|
||||
/* Must be super user */
|
||||
if (!superuser())
|
||||
@ -833,7 +833,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
|
||||
|
||||
InvokeObjectPostAlterHook(ForeignDataWrapperRelationId, fdwId, 0);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return myself;
|
||||
}
|
||||
@ -848,7 +848,7 @@ RemoveForeignDataWrapperById(Oid fdwId)
|
||||
HeapTuple tp;
|
||||
Relation rel;
|
||||
|
||||
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
|
||||
|
||||
tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwId));
|
||||
|
||||
@ -859,7 +859,7 @@ RemoveForeignDataWrapperById(Oid fdwId)
|
||||
|
||||
ReleaseSysCache(tp);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
|
||||
@ -881,7 +881,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
|
||||
ObjectAddress referenced;
|
||||
ForeignDataWrapper *fdw;
|
||||
|
||||
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
|
||||
/* For now the owner cannot be specified on create. Use effective user ID. */
|
||||
ownerId = GetUserId();
|
||||
@ -898,7 +898,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
|
||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||
errmsg("server \"%s\" already exists, skipping",
|
||||
stmt->servername)));
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
return InvalidObjectAddress;
|
||||
}
|
||||
else
|
||||
@ -984,7 +984,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
|
||||
/* Post creation hook for new foreign server */
|
||||
InvokeObjectPostCreateHook(ForeignServerRelationId, srvId, 0);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return myself;
|
||||
}
|
||||
@ -1005,7 +1005,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
|
||||
Form_pg_foreign_server srvForm;
|
||||
ObjectAddress address;
|
||||
|
||||
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
|
||||
tp = SearchSysCacheCopy1(FOREIGNSERVERNAME,
|
||||
CStringGetDatum(stmt->servername));
|
||||
@ -1083,7 +1083,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
|
||||
|
||||
heap_freetuple(tp);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -1098,7 +1098,7 @@ RemoveForeignServerById(Oid srvId)
|
||||
HeapTuple tp;
|
||||
Relation rel;
|
||||
|
||||
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
rel = table_open(ForeignServerRelationId, RowExclusiveLock);
|
||||
|
||||
tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
|
||||
|
||||
@ -1109,7 +1109,7 @@ RemoveForeignServerById(Oid srvId)
|
||||
|
||||
ReleaseSysCache(tp);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
|
||||
@ -1159,7 +1159,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
|
||||
ForeignDataWrapper *fdw;
|
||||
RoleSpec *role = (RoleSpec *) stmt->user;
|
||||
|
||||
rel = heap_open(UserMappingRelationId, RowExclusiveLock);
|
||||
rel = table_open(UserMappingRelationId, RowExclusiveLock);
|
||||
|
||||
if (role->roletype == ROLESPEC_PUBLIC)
|
||||
useId = ACL_ID_PUBLIC;
|
||||
@ -1188,7 +1188,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
|
||||
MappingUserName(useId),
|
||||
stmt->servername)));
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
return InvalidObjectAddress;
|
||||
}
|
||||
else
|
||||
@ -1256,7 +1256,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
|
||||
/* Post creation hook for new user mapping */
|
||||
InvokeObjectPostCreateHook(UserMappingRelationId, umId, 0);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return myself;
|
||||
}
|
||||
@ -1279,7 +1279,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
|
||||
ObjectAddress address;
|
||||
RoleSpec *role = (RoleSpec *) stmt->user;
|
||||
|
||||
rel = heap_open(UserMappingRelationId, RowExclusiveLock);
|
||||
rel = table_open(UserMappingRelationId, RowExclusiveLock);
|
||||
|
||||
if (role->roletype == ROLESPEC_PUBLIC)
|
||||
useId = ACL_ID_PUBLIC;
|
||||
@ -1351,7 +1351,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
|
||||
|
||||
heap_freetuple(tp);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -1443,7 +1443,7 @@ RemoveUserMappingById(Oid umId)
|
||||
HeapTuple tp;
|
||||
Relation rel;
|
||||
|
||||
rel = heap_open(UserMappingRelationId, RowExclusiveLock);
|
||||
rel = table_open(UserMappingRelationId, RowExclusiveLock);
|
||||
|
||||
tp = SearchSysCache1(USERMAPPINGOID, ObjectIdGetDatum(umId));
|
||||
|
||||
@ -1454,7 +1454,7 @@ RemoveUserMappingById(Oid umId)
|
||||
|
||||
ReleaseSysCache(tp);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1482,7 +1482,7 @@ CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
|
||||
*/
|
||||
CommandCounterIncrement();
|
||||
|
||||
ftrel = heap_open(ForeignTableRelationId, RowExclusiveLock);
|
||||
ftrel = table_open(ForeignTableRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* For now the owner cannot be specified on create. Use effective user ID.
|
||||
@ -1535,7 +1535,7 @@ CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
|
||||
referenced.objectSubId = 0;
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
|
||||
|
||||
heap_close(ftrel, RowExclusiveLock);
|
||||
table_close(ftrel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user