mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +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:
@ -144,7 +144,7 @@ get_extension_oid(const char *extname, bool missing_ok)
|
||||
HeapTuple tuple;
|
||||
ScanKeyData entry[1];
|
||||
|
||||
rel = heap_open(ExtensionRelationId, AccessShareLock);
|
||||
rel = table_open(ExtensionRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&entry[0],
|
||||
Anum_pg_extension_extname,
|
||||
@ -164,7 +164,7 @@ get_extension_oid(const char *extname, bool missing_ok)
|
||||
|
||||
systable_endscan(scandesc);
|
||||
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
if (!OidIsValid(result) && !missing_ok)
|
||||
ereport(ERROR,
|
||||
@ -189,7 +189,7 @@ get_extension_name(Oid ext_oid)
|
||||
HeapTuple tuple;
|
||||
ScanKeyData entry[1];
|
||||
|
||||
rel = heap_open(ExtensionRelationId, AccessShareLock);
|
||||
rel = table_open(ExtensionRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&entry[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -209,7 +209,7 @@ get_extension_name(Oid ext_oid)
|
||||
|
||||
systable_endscan(scandesc);
|
||||
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -228,7 +228,7 @@ get_extension_schema(Oid ext_oid)
|
||||
HeapTuple tuple;
|
||||
ScanKeyData entry[1];
|
||||
|
||||
rel = heap_open(ExtensionRelationId, AccessShareLock);
|
||||
rel = table_open(ExtensionRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&entry[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -248,7 +248,7 @@ get_extension_schema(Oid ext_oid)
|
||||
|
||||
systable_endscan(scandesc);
|
||||
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1764,7 +1764,7 @@ InsertExtensionTuple(const char *extName, Oid extOwner,
|
||||
/*
|
||||
* Build and insert the pg_extension tuple
|
||||
*/
|
||||
rel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
rel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
memset(values, 0, sizeof(values));
|
||||
memset(nulls, 0, sizeof(nulls));
|
||||
@ -1794,7 +1794,7 @@ InsertExtensionTuple(const char *extName, Oid extOwner,
|
||||
CatalogTupleInsert(rel, tuple);
|
||||
|
||||
heap_freetuple(tuple);
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Record dependencies on owner, schema, and prerequisite extensions
|
||||
@ -1859,7 +1859,7 @@ RemoveExtensionById(Oid extId)
|
||||
errmsg("cannot drop extension \"%s\" because it is being modified",
|
||||
get_extension_name(extId))));
|
||||
|
||||
rel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
rel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&entry[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -1876,7 +1876,7 @@ RemoveExtensionById(Oid extId)
|
||||
|
||||
systable_endscan(scandesc);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2387,7 +2387,7 @@ pg_extension_config_dump(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
|
||||
/* Find the pg_extension tuple */
|
||||
extRel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
extRel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -2506,7 +2506,7 @@ pg_extension_config_dump(PG_FUNCTION_ARGS)
|
||||
|
||||
systable_endscan(extScan);
|
||||
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
@ -2535,7 +2535,7 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
|
||||
ArrayType *a;
|
||||
|
||||
/* Find the pg_extension tuple */
|
||||
extRel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
extRel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -2593,7 +2593,7 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
|
||||
if (arrayIndex < 0)
|
||||
{
|
||||
systable_endscan(extScan);
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2681,7 +2681,7 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
|
||||
|
||||
systable_endscan(extScan);
|
||||
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2734,7 +2734,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o
|
||||
extensionName, newschema)));
|
||||
|
||||
/* Locate the pg_extension tuple */
|
||||
extRel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
extRel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -2762,7 +2762,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o
|
||||
*/
|
||||
if (extForm->extnamespace == nspOid)
|
||||
{
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
return InvalidObjectAddress;
|
||||
}
|
||||
|
||||
@ -2779,7 +2779,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o
|
||||
* Scan pg_depend to find objects that depend directly on the extension,
|
||||
* and alter each one's schema.
|
||||
*/
|
||||
depRel = heap_open(DependRelationId, AccessShareLock);
|
||||
depRel = table_open(DependRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_depend_refclassid,
|
||||
@ -2853,7 +2853,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o
|
||||
|
||||
CatalogTupleUpdate(extRel, &extTup->t_self, extTup);
|
||||
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
|
||||
/* update dependencies to point to the new schema */
|
||||
changeDependencyFor(ExtensionRelationId, extensionOid,
|
||||
@ -2899,7 +2899,7 @@ ExecAlterExtensionStmt(ParseState *pstate, AlterExtensionStmt *stmt)
|
||||
/*
|
||||
* Look up the extension --- it must already exist in pg_extension
|
||||
*/
|
||||
extRel = heap_open(ExtensionRelationId, AccessShareLock);
|
||||
extRel = table_open(ExtensionRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_extension_extname,
|
||||
@ -2930,7 +2930,7 @@ ExecAlterExtensionStmt(ParseState *pstate, AlterExtensionStmt *stmt)
|
||||
|
||||
systable_endscan(extScan);
|
||||
|
||||
heap_close(extRel, AccessShareLock);
|
||||
table_close(extRel, AccessShareLock);
|
||||
|
||||
/* Permission check: must own extension */
|
||||
if (!pg_extension_ownercheck(extensionOid, GetUserId()))
|
||||
@ -3056,7 +3056,7 @@ ApplyExtensionUpdates(Oid extensionOid,
|
||||
control = read_extension_aux_control_file(pcontrol, versionName);
|
||||
|
||||
/* Find the pg_extension tuple */
|
||||
extRel = heap_open(ExtensionRelationId, RowExclusiveLock);
|
||||
extRel = table_open(ExtensionRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&key[0],
|
||||
Anum_pg_extension_oid,
|
||||
@ -3101,7 +3101,7 @@ ApplyExtensionUpdates(Oid extensionOid,
|
||||
|
||||
systable_endscan(extScan);
|
||||
|
||||
heap_close(extRel, RowExclusiveLock);
|
||||
table_close(extRel, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Look up the prerequisite extensions for this version, install them
|
||||
|
Reference in New Issue
Block a user