mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -77,7 +77,7 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
|
||||
* XXX - uncoming version of libselinux supports to take object name to
|
||||
* handle special treatment on default security label.
|
||||
*/
|
||||
rel = heap_open(DatabaseRelationId, AccessShareLock);
|
||||
rel = table_open(DatabaseRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_database_oid,
|
||||
@ -110,7 +110,7 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
|
||||
true);
|
||||
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
/*
|
||||
* Assign the default security label on the new database
|
||||
|
@ -727,7 +727,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
|
||||
* Open the target catalog. We don't want to allow writable accesses by
|
||||
* other session during initial labeling.
|
||||
*/
|
||||
rel = heap_open(catalogId, AccessShareLock);
|
||||
rel = table_open(catalogId, AccessShareLock);
|
||||
|
||||
sscan = systable_beginscan(rel, InvalidOid, false,
|
||||
NULL, 0, NULL);
|
||||
@ -881,7 +881,7 @@ exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId)
|
||||
}
|
||||
systable_endscan(sscan);
|
||||
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -56,7 +56,7 @@ sepgsql_proc_post_create(Oid functionId)
|
||||
* Fetch namespace of the new procedure. Because pg_proc entry is not
|
||||
* visible right now, we need to scan the catalog using SnapshotSelf.
|
||||
*/
|
||||
rel = heap_open(ProcedureRelationId, AccessShareLock);
|
||||
rel = table_open(ProcedureRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_proc_oid,
|
||||
@ -141,7 +141,7 @@ sepgsql_proc_post_create(Oid functionId)
|
||||
* Cleanup
|
||||
*/
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
pfree(audit_name.data);
|
||||
pfree(tcontext);
|
||||
@ -250,7 +250,7 @@ sepgsql_proc_setattr(Oid functionId)
|
||||
/*
|
||||
* Fetch newer catalog
|
||||
*/
|
||||
rel = heap_open(ProcedureRelationId, AccessShareLock);
|
||||
rel = table_open(ProcedureRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_proc_oid,
|
||||
@ -305,7 +305,7 @@ sepgsql_proc_setattr(Oid functionId)
|
||||
|
||||
ReleaseSysCache(oldtup);
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,7 +67,7 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum)
|
||||
* Compute a default security label of the new column underlying the
|
||||
* specified relation, and check permission to create it.
|
||||
*/
|
||||
rel = heap_open(AttributeRelationId, AccessShareLock);
|
||||
rel = table_open(AttributeRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey[0],
|
||||
Anum_pg_attribute_attrelid,
|
||||
@ -120,7 +120,7 @@ sepgsql_attribute_post_create(Oid relOid, AttrNumber attnum)
|
||||
SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, ncontext);
|
||||
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
pfree(tcontext);
|
||||
pfree(ncontext);
|
||||
@ -259,7 +259,7 @@ sepgsql_relation_post_create(Oid relOid)
|
||||
* Fetch catalog record of the new relation. Because pg_class entry is not
|
||||
* visible right now, we need to scan the catalog using SnapshotSelf.
|
||||
*/
|
||||
rel = heap_open(RelationRelationId, AccessShareLock);
|
||||
rel = table_open(RelationRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_class_oid,
|
||||
@ -358,7 +358,7 @@ sepgsql_relation_post_create(Oid relOid)
|
||||
HeapTuple atup;
|
||||
Form_pg_attribute attForm;
|
||||
|
||||
arel = heap_open(AttributeRelationId, AccessShareLock);
|
||||
arel = table_open(AttributeRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&akey,
|
||||
Anum_pg_attribute_attrelid,
|
||||
@ -400,13 +400,13 @@ sepgsql_relation_post_create(Oid relOid)
|
||||
pfree(ccontext);
|
||||
}
|
||||
systable_endscan(ascan);
|
||||
heap_close(arel, AccessShareLock);
|
||||
table_close(arel, AccessShareLock);
|
||||
}
|
||||
pfree(rcontext);
|
||||
|
||||
out:
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -611,7 +611,7 @@ sepgsql_relation_setattr(Oid relOid)
|
||||
/*
|
||||
* Fetch newer catalog
|
||||
*/
|
||||
rel = heap_open(RelationRelationId, AccessShareLock);
|
||||
rel = table_open(RelationRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_class_oid,
|
||||
@ -667,7 +667,7 @@ sepgsql_relation_setattr(Oid relOid)
|
||||
|
||||
ReleaseSysCache(oldtup);
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -723,7 +723,7 @@ sepgsql_relation_setattr_extra(Relation catalog,
|
||||
static void
|
||||
sepgsql_index_modify(Oid indexOid)
|
||||
{
|
||||
Relation catalog = heap_open(IndexRelationId, AccessShareLock);
|
||||
Relation catalog = table_open(IndexRelationId, AccessShareLock);
|
||||
|
||||
/* check db_table:{setattr} permission of the table being indexed */
|
||||
sepgsql_relation_setattr_extra(catalog,
|
||||
@ -731,5 +731,5 @@ sepgsql_index_modify(Oid indexOid)
|
||||
indexOid,
|
||||
Anum_pg_index_indrelid,
|
||||
Anum_pg_index_indexrelid);
|
||||
heap_close(catalog, AccessShareLock);
|
||||
table_close(catalog, AccessShareLock);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ sepgsql_schema_post_create(Oid namespaceId)
|
||||
* handle special treatment on default security label; such as special
|
||||
* label on "pg_temp" schema.
|
||||
*/
|
||||
rel = heap_open(NamespaceRelationId, AccessShareLock);
|
||||
rel = table_open(NamespaceRelationId, AccessShareLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_namespace_oid,
|
||||
@ -93,7 +93,7 @@ sepgsql_schema_post_create(Oid namespaceId)
|
||||
audit_name.data,
|
||||
true);
|
||||
systable_endscan(sscan);
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
|
||||
/*
|
||||
* Assign the default security label on a new procedure
|
||||
|
Reference in New Issue
Block a user