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:
Andres Freund 2019-01-21 10:32:19 -08:00
parent 111944c5ee
commit e0c4ec0728
114 changed files with 1259 additions and 1259 deletions

View File

@ -219,7 +219,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed)
*/
heapid = IndexGetRelation(indrelid, true);
if (OidIsValid(heapid))
heaprel = heap_open(heapid, lockmode);
heaprel = table_open(heapid, lockmode);
else
heaprel = NULL;
@ -261,7 +261,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed)
*/
index_close(indrel, lockmode);
if (heaprel)
heap_close(heaprel, lockmode);
table_close(heaprel, lockmode);
}
/*

View File

@ -2050,7 +2050,7 @@ get_pkey_attnames(Relation rel, int16 *indnkeyatts)
tupdesc = rel->rd_att;
/* Prepare to scan pg_index for entries having indrelid = this rel. */
indexRelation = heap_open(IndexRelationId, AccessShareLock);
indexRelation = table_open(IndexRelationId, AccessShareLock);
ScanKeyInit(&skey,
Anum_pg_index_indrelid,
BTEqualStrategyNumber, F_OIDEQ,
@ -2079,7 +2079,7 @@ get_pkey_attnames(Relation rel, int16 *indnkeyatts)
}
systable_endscan(scan);
heap_close(indexRelation, AccessShareLock);
table_close(indexRelation, AccessShareLock);
return result;
}
@ -2503,7 +2503,7 @@ get_rel_from_relname(text *relname_text, LOCKMODE lockmode, AclMode aclmode)
AclResult aclresult;
relvar = makeRangeVarFromNameList(textToQualifiedNameList(relname_text));
rel = heap_openrv(relvar, lockmode);
rel = table_openrv(relvar, lockmode);
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
aclmode);

View File

@ -439,7 +439,7 @@ get_file_fdw_attribute_options(Oid relid)
List *options = NIL;
rel = heap_open(relid, AccessShareLock);
rel = table_open(relid, AccessShareLock);
tupleDesc = RelationGetDescr(rel);
natts = tupleDesc->natts;
@ -481,7 +481,7 @@ get_file_fdw_attribute_options(Oid relid)
}
}
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
/*
* Return DefElem only when some column(s) have force_not_null /
@ -892,7 +892,7 @@ check_selective_binary_conversion(RelOptInfo *baserel,
}
/* Convert attribute numbers to column names. */
rel = heap_open(foreigntableid, AccessShareLock);
rel = table_open(foreigntableid, AccessShareLock);
tupleDesc = RelationGetDescr(rel);
while ((attnum = bms_first_member(attrs_used)) >= 0)
@ -934,7 +934,7 @@ check_selective_binary_conversion(RelOptInfo *baserel,
numattrs++;
}
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
/* If there's a whole-row reference, fail: we need all the columns. */
if (has_wholerow)

View File

@ -307,7 +307,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
}
heap_endscan(scan);
heap_close(mydata->rel, AccessShareLock);
table_close(mydata->rel, AccessShareLock);
SRF_RETURN_DONE(funcctx);
}

View File

@ -1048,11 +1048,11 @@ deparseSelectSql(List *tlist, bool is_subquery, List **retrieved_attrs,
* Core code already has some lock on each rel being planned, so we
* can use NoLock here.
*/
Relation rel = heap_open(rte->relid, NoLock);
Relation rel = table_open(rte->relid, NoLock);
deparseTargetList(buf, rte, foreignrel->relid, rel, false,
fpinfo->attrs_used, false, retrieved_attrs);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
}
@ -1543,7 +1543,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
* Core code already has some lock on each rel being planned, so we
* can use NoLock here.
*/
Relation rel = heap_open(rte->relid, NoLock);
Relation rel = table_open(rte->relid, NoLock);
deparseRelation(buf, rel);
@ -1555,7 +1555,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
if (use_alias)
appendStringInfo(buf, " %s%d", REL_ALIAS_PREFIX, foreignrel->relid);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
}
@ -2097,7 +2097,7 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte,
* The lock on the relation will be held by upper callers, so it's
* fine to open it with no lock here.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
/*
* The local name of the foreign table can not be recognized by the
@ -2132,7 +2132,7 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte,
if (qualify_col)
appendStringInfoString(buf, " END");
heap_close(rel, NoLock);
table_close(rel, NoLock);
bms_free(attrs_used);
}
else

View File

@ -1616,7 +1616,7 @@ postgresPlanForeignModify(PlannerInfo *root,
* Core code already has some lock on each rel being planned, so we can
* use NoLock here.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
/*
* In an INSERT, we transmit all columns that are defined in the foreign
@ -1706,7 +1706,7 @@ postgresPlanForeignModify(PlannerInfo *root,
break;
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* Build the fdw_private list that will be available to the executor.
@ -2121,7 +2121,7 @@ postgresPlanDirectModify(PlannerInfo *root,
* Core code already has some lock on each rel being planned, so we can
* use NoLock here.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
/*
* Recall the qual clauses that must be evaluated remotely. (These are
@ -2207,7 +2207,7 @@ postgresPlanDirectModify(PlannerInfo *root,
rebuild_fdw_scan_tlist(fscan, returningList);
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
return true;
}

View File

@ -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

View File

@ -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);
}
/*

View File

@ -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);
}
/*

View File

@ -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);
}

View File

@ -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

View File

@ -390,9 +390,9 @@ bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
* iterate on the revmap.
*/
heapOid = IndexGetRelation(RelationGetRelid(idxRel), false);
heapRel = heap_open(heapOid, AccessShareLock);
heapRel = table_open(heapOid, AccessShareLock);
nblocks = RelationGetNumberOfBlocks(heapRel);
heap_close(heapRel, AccessShareLock);
table_close(heapRel, AccessShareLock);
/*
* Make room for the consistent support procedures of indexed columns. We
@ -799,15 +799,15 @@ brinvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
stats->num_pages = RelationGetNumberOfBlocks(info->index);
/* rest of stats is initialized by zeroing */
heapRel = heap_open(IndexGetRelation(RelationGetRelid(info->index), false),
AccessShareLock);
heapRel = table_open(IndexGetRelation(RelationGetRelid(info->index), false),
AccessShareLock);
brin_vacuum_scan(info->index, info->strategy);
brinsummarize(info->index, heapRel, BRIN_ALL_BLOCKRANGES, false,
&stats->num_index_tuples, &stats->num_index_tuples);
heap_close(heapRel, AccessShareLock);
table_close(heapRel, AccessShareLock);
return stats;
}
@ -897,7 +897,7 @@ brin_summarize_range(PG_FUNCTION_ARGS)
*/
heapoid = IndexGetRelation(indexoid, true);
if (OidIsValid(heapoid))
heapRel = heap_open(heapoid, ShareUpdateExclusiveLock);
heapRel = table_open(heapoid, ShareUpdateExclusiveLock);
else
heapRel = NULL;
@ -974,7 +974,7 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
*/
heapoid = IndexGetRelation(indexoid, true);
if (OidIsValid(heapoid))
heapRel = heap_open(heapoid, ShareUpdateExclusiveLock);
heapRel = table_open(heapoid, ShareUpdateExclusiveLock);
else
heapRel = NULL;

View File

@ -8990,10 +8990,10 @@ heap_sync(Relation rel)
{
Relation toastrel;
toastrel = heap_open(rel->rd_rel->reltoastrelid, AccessShareLock);
toastrel = table_open(rel->rd_rel->reltoastrelid, AccessShareLock);
FlushRelationBuffers(toastrel);
smgrimmedsync(toastrel->rd_smgr, MAIN_FORKNUM);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
}
}

View File

@ -1422,7 +1422,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
Relation toastrel;
/* Open the toast relation */
toastrel = heap_open(toastoid, lock);
toastrel = table_open(toastoid, lock);
/* Look for the valid index of the toast relation */
validIndex = toast_open_indexes(toastrel,
@ -1433,7 +1433,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
/* Close the toast relation and all its indexes */
toast_close_indexes(toastidxs, num_indexes, lock);
heap_close(toastrel, lock);
table_close(toastrel, lock);
return validIndexOid;
}
@ -1487,7 +1487,7 @@ toast_save_datum(Relation rel, Datum value,
* uniqueness of the OID we assign to the toasted item, even though it has
* additional columns besides OID.
*/
toastrel = heap_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
toastrel = table_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
toasttupDesc = toastrel->rd_att;
/* Open all the toast indexes and look for the valid one */
@ -1692,7 +1692,7 @@ toast_save_datum(Relation rel, Datum value,
* Done - close toast relation and its indexes
*/
toast_close_indexes(toastidxs, num_indexes, RowExclusiveLock);
heap_close(toastrel, RowExclusiveLock);
table_close(toastrel, RowExclusiveLock);
/*
* Create the TOAST pointer value that we'll return
@ -1734,7 +1734,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, RowExclusiveLock);
toastrel = table_open(toast_pointer.va_toastrelid, RowExclusiveLock);
/* Fetch valid relation used for process */
validIndex = toast_open_indexes(toastrel,
@ -1774,7 +1774,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, RowExclusiveLock);
heap_close(toastrel, RowExclusiveLock);
table_close(toastrel, RowExclusiveLock);
}
@ -1840,11 +1840,11 @@ toastid_valueid_exists(Oid toastrelid, Oid valueid)
bool result;
Relation toastrel;
toastrel = heap_open(toastrelid, AccessShareLock);
toastrel = table_open(toastrelid, AccessShareLock);
result = toastrel_valueid_exists(toastrel, valueid);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}
@ -1899,7 +1899,7 @@ toast_fetch_datum(struct varlena *attr)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, AccessShareLock);
toastrel = table_open(toast_pointer.va_toastrelid, AccessShareLock);
toasttupDesc = toastrel->rd_att;
/* Look for the valid index of the toast relation */
@ -2016,7 +2016,7 @@ toast_fetch_datum(struct varlena *attr)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, AccessShareLock);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}
@ -2102,7 +2102,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, AccessShareLock);
toastrel = table_open(toast_pointer.va_toastrelid, AccessShareLock);
toasttupDesc = toastrel->rd_att;
/* Look for the valid index of toast relation */
@ -2249,7 +2249,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, AccessShareLock);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}

View File

@ -1550,7 +1550,7 @@ _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc)
}
/* Open relations within worker */
heapRel = heap_open(btshared->heaprelid, heapLockmode);
heapRel = table_open(btshared->heaprelid, heapLockmode);
indexRel = index_open(btshared->indexrelid, indexLockmode);
/* Initialize worker's own spool */
@ -1595,7 +1595,7 @@ _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc)
#endif /* BTREE_BUILD_STATS */
index_close(indexRel, indexLockmode);
heap_close(heapRel, heapLockmode);
table_close(heapRel, heapLockmode);
}
/*

View File

@ -604,7 +604,7 @@ boot_openrel(char *relname)
if (Typ == NULL)
{
/* We can now load the pg_type data */
rel = heap_open(TypeRelationId, NoLock);
rel = table_open(TypeRelationId, NoLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
i = 0;
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
@ -625,7 +625,7 @@ boot_openrel(char *relname)
app++;
}
heap_endscan(scan);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
if (boot_reldesc != NULL)
@ -634,7 +634,7 @@ boot_openrel(char *relname)
elog(DEBUG4, "open relation %s, attrsize %d",
relname, (int) ATTRIBUTE_FIXED_PART_SIZE);
boot_reldesc = heap_openrv(makeRangeVar(NULL, relname, -1), NoLock);
boot_reldesc = table_openrv(makeRangeVar(NULL, relname, -1), NoLock);
numattr = RelationGetNumberOfAttributes(boot_reldesc);
for (i = 0; i < numattr; i++)
{
@ -680,7 +680,7 @@ closerel(char *name)
{
elog(DEBUG4, "close relation %s",
RelationGetRelationName(boot_reldesc));
heap_close(boot_reldesc, NoLock);
table_close(boot_reldesc, NoLock);
boot_reldesc = NULL;
}
}
@ -939,7 +939,7 @@ gettype(char *type)
return i;
}
elog(DEBUG4, "external type: %s", type);
rel = heap_open(TypeRelationId, NoLock);
rel = table_open(TypeRelationId, NoLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
i = 0;
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
@ -959,7 +959,7 @@ gettype(char *type)
sizeof((*app)->am_typ));
}
heap_endscan(scan);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return gettype(type);
}
elog(ERROR, "unrecognized type \"%s\"", type);
@ -1128,12 +1128,12 @@ build_indices(void)
Relation ind;
/* need not bother with locks during bootstrap */
heap = heap_open(ILHead->il_heap, NoLock);
heap = table_open(ILHead->il_heap, NoLock);
ind = index_open(ILHead->il_ind, NoLock);
index_build(heap, ind, ILHead->il_info, false, false, false);
index_close(ind, NoLock);
heap_close(heap, NoLock);
table_close(heap, NoLock);
}
}

View File

@ -843,7 +843,7 @@ objectsInSchemaToOids(ObjectType objtype, List *nspnames)
BTEqualStrategyNumber, F_CHAREQ,
CharGetDatum(PROKIND_PROCEDURE));
rel = heap_open(ProcedureRelationId, AccessShareLock);
rel = table_open(ProcedureRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, keycount, key);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
@ -854,7 +854,7 @@ objectsInSchemaToOids(ObjectType objtype, List *nspnames)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
}
break;
default:
@ -890,7 +890,7 @@ getRelationsInNamespace(Oid namespaceId, char relkind)
BTEqualStrategyNumber, F_CHAREQ,
CharGetDatum(relkind));
rel = heap_open(RelationRelationId, AccessShareLock);
rel = table_open(RelationRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 2, key);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
@ -901,7 +901,7 @@ getRelationsInNamespace(Oid namespaceId, char relkind)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return relations;
}
@ -1166,7 +1166,7 @@ SetDefaultACL(InternalDefaultACL *iacls)
Oid *oldmembers;
Oid *newmembers;
rel = heap_open(DefaultAclRelationId, RowExclusiveLock);
rel = table_open(DefaultAclRelationId, RowExclusiveLock);
/*
* The default for a global entry is the hard-wired default ACL for the
@ -1390,7 +1390,7 @@ SetDefaultACL(InternalDefaultACL *iacls)
if (HeapTupleIsValid(tuple))
ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
@ -1412,7 +1412,7 @@ RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
HeapTuple tuple;
/* first fetch info needed by SetDefaultACL */
rel = heap_open(DefaultAclRelationId, AccessShareLock);
rel = table_open(DefaultAclRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_default_acl_oid,
@ -1457,7 +1457,7 @@ RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
}
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
iacls.is_grant = false;
iacls.all_privs = true;
@ -1535,7 +1535,7 @@ RemoveDefaultACLById(Oid defaclOid)
SysScanDesc scan;
HeapTuple tuple;
rel = heap_open(DefaultAclRelationId, RowExclusiveLock);
rel = table_open(DefaultAclRelationId, RowExclusiveLock);
ScanKeyInit(&skey[0],
Anum_pg_default_acl_oid,
@ -1553,7 +1553,7 @@ RemoveDefaultACLById(Oid defaclOid)
CatalogTupleDelete(rel, &tuple->t_self);
systable_endscan(scan);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
@ -1798,8 +1798,8 @@ ExecGrant_Relation(InternalGrant *istmt)
Relation attRelation;
ListCell *cell;
relation = heap_open(RelationRelationId, RowExclusiveLock);
attRelation = heap_open(AttributeRelationId, RowExclusiveLock);
relation = table_open(RelationRelationId, RowExclusiveLock);
attRelation = table_open(AttributeRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2119,8 +2119,8 @@ ExecGrant_Relation(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(attRelation, RowExclusiveLock);
heap_close(relation, RowExclusiveLock);
table_close(attRelation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2132,7 +2132,7 @@ ExecGrant_Database(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_DATABASE;
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
relation = table_open(DatabaseRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2240,7 +2240,7 @@ ExecGrant_Database(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2252,7 +2252,7 @@ ExecGrant_Fdw(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_FDW;
relation = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
relation = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2367,7 +2367,7 @@ ExecGrant_Fdw(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2379,7 +2379,7 @@ ExecGrant_ForeignServer(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_FOREIGN_SERVER;
relation = heap_open(ForeignServerRelationId, RowExclusiveLock);
relation = table_open(ForeignServerRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2492,7 +2492,7 @@ ExecGrant_ForeignServer(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2504,7 +2504,7 @@ ExecGrant_Function(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_FUNCTION;
relation = heap_open(ProcedureRelationId, RowExclusiveLock);
relation = table_open(ProcedureRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2615,7 +2615,7 @@ ExecGrant_Function(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2627,7 +2627,7 @@ ExecGrant_Language(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_LANGUAGE;
relation = heap_open(LanguageRelationId, RowExclusiveLock);
relation = table_open(LanguageRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2746,7 +2746,7 @@ ExecGrant_Language(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2758,8 +2758,8 @@ ExecGrant_Largeobject(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_LARGEOBJECT;
relation = heap_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
relation = table_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -2886,7 +2886,7 @@ ExecGrant_Largeobject(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -2898,7 +2898,7 @@ ExecGrant_Namespace(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_SCHEMA;
relation = heap_open(NamespaceRelationId, RowExclusiveLock);
relation = table_open(NamespaceRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -3010,7 +3010,7 @@ ExecGrant_Namespace(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -3022,7 +3022,7 @@ ExecGrant_Tablespace(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_TABLESPACE;
relation = heap_open(TableSpaceRelationId, RowExclusiveLock);
relation = table_open(TableSpaceRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -3130,7 +3130,7 @@ ExecGrant_Tablespace(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
static void
@ -3142,7 +3142,7 @@ ExecGrant_Type(InternalGrant *istmt)
if (istmt->all_privs && istmt->privileges == ACL_NO_RIGHTS)
istmt->privileges = ACL_ALL_RIGHTS_TYPE;
relation = heap_open(TypeRelationId, RowExclusiveLock);
relation = table_open(TypeRelationId, RowExclusiveLock);
foreach(cell, istmt->objects)
{
@ -3267,7 +3267,7 @@ ExecGrant_Type(InternalGrant *istmt)
CommandCounterIncrement();
}
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
@ -4116,8 +4116,8 @@ pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,
/*
* Get the largeobject's ACL from pg_language_metadata
*/
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
AccessShareLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_largeobject_metadata_oid,
@ -4159,7 +4159,7 @@ pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,
systable_endscan(scan);
heap_close(pg_lo_meta, AccessShareLock);
table_close(pg_lo_meta, AccessShareLock);
return result;
}
@ -4898,8 +4898,8 @@ pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid)
return true;
/* There's no syscache for pg_largeobject_metadata */
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
AccessShareLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_largeobject_metadata_oid,
@ -4919,7 +4919,7 @@ pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid)
ownerId = ((Form_pg_largeobject_metadata) GETSTRUCT(tuple))->lomowner;
systable_endscan(scan);
heap_close(pg_lo_meta, AccessShareLock);
table_close(pg_lo_meta, AccessShareLock);
return has_privs_of_role(roleid, ownerId);
}
@ -5261,7 +5261,7 @@ pg_extension_ownercheck(Oid ext_oid, Oid roleid)
return true;
/* There's no syscache for pg_extension, so do it the hard way */
pg_extension = heap_open(ExtensionRelationId, AccessShareLock);
pg_extension = table_open(ExtensionRelationId, AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_extension_oid,
@ -5281,7 +5281,7 @@ pg_extension_ownercheck(Oid ext_oid, Oid roleid)
ownerId = ((Form_pg_extension) GETSTRUCT(tuple))->extowner;
systable_endscan(scan);
heap_close(pg_extension, AccessShareLock);
table_close(pg_extension, AccessShareLock);
return has_privs_of_role(roleid, ownerId);
}
@ -5726,7 +5726,7 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
SysScanDesc scan;
Relation relation;
relation = heap_open(LargeObjectMetadataRelationId, RowExclusiveLock);
relation = table_open(LargeObjectMetadataRelationId, RowExclusiveLock);
/* There's no syscache for pg_largeobject_metadata */
ScanKeyInit(&entry[0],
@ -5968,7 +5968,7 @@ recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid, Acl *new_a
HeapTuple tuple;
HeapTuple oldtuple;
relation = heap_open(InitPrivsRelationId, RowExclusiveLock);
relation = table_open(InitPrivsRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_init_privs_objoid,
@ -6054,5 +6054,5 @@ recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid, Acl *new_a
/* prevent error when processing objects multiple times */
CommandCounterIncrement();
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}

View File

@ -481,7 +481,7 @@ pg_nextoid(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to call pg_nextoid")));
rel = heap_open(reloid, RowExclusiveLock);
rel = table_open(reloid, RowExclusiveLock);
idx = index_open(idxoid, RowExclusiveLock);
if (!IsSystemRelation(rel))
@ -523,7 +523,7 @@ pg_nextoid(PG_FUNCTION_ARGS)
newoid = GetNewOidWithIndex(rel, idxoid, attno);
ReleaseSysCache(atttuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
index_close(idx, RowExclusiveLock);
return newoid;

View File

@ -317,7 +317,7 @@ performDeletion(const ObjectAddress *object,
* We save some cycles by opening pg_depend just once and passing the
* Relation pointer down to all the recursive deletion steps.
*/
depRel = heap_open(DependRelationId, RowExclusiveLock);
depRel = table_open(DependRelationId, RowExclusiveLock);
/*
* Acquire deletion lock on the target object. (Ideally the caller has
@ -353,7 +353,7 @@ performDeletion(const ObjectAddress *object,
/* And clean up */
free_object_addresses(targetObjects);
heap_close(depRel, RowExclusiveLock);
table_close(depRel, RowExclusiveLock);
}
/*
@ -381,7 +381,7 @@ performMultipleDeletions(const ObjectAddresses *objects,
* We save some cycles by opening pg_depend just once and passing the
* Relation pointer down to all the recursive deletion steps.
*/
depRel = heap_open(DependRelationId, RowExclusiveLock);
depRel = table_open(DependRelationId, RowExclusiveLock);
/*
* Construct a list of objects to delete (ie, the given objects plus
@ -429,7 +429,7 @@ performMultipleDeletions(const ObjectAddresses *objects,
/* And clean up */
free_object_addresses(targetObjects);
heap_close(depRel, RowExclusiveLock);
table_close(depRel, RowExclusiveLock);
}
/*
@ -1086,7 +1086,7 @@ deleteOneObject(const ObjectAddress *object, Relation *depRel, int flags)
* relation open across doDeletion().
*/
if (flags & PERFORM_DELETION_CONCURRENTLY)
heap_close(*depRel, RowExclusiveLock);
table_close(*depRel, RowExclusiveLock);
/*
* Delete the object itself, in an object-type-dependent way.
@ -1103,7 +1103,7 @@ deleteOneObject(const ObjectAddress *object, Relation *depRel, int flags)
* Reopen depRel if we closed it above
*/
if (flags & PERFORM_DELETION_CONCURRENTLY)
*depRel = heap_open(DependRelationId, RowExclusiveLock);
*depRel = table_open(DependRelationId, RowExclusiveLock);
/*
* Now remove any pg_depend records that link from this object to others.
@ -2640,7 +2640,7 @@ DeleteInitPrivs(const ObjectAddress *object)
SysScanDesc scan;
HeapTuple oldtuple;
relation = heap_open(InitPrivsRelationId, RowExclusiveLock);
relation = table_open(InitPrivsRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_init_privs_objoid,
@ -2663,5 +2663,5 @@ DeleteInitPrivs(const ObjectAddress *object)
systable_endscan(scan);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}

View File

@ -713,7 +713,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
/*
* open pg_attribute and its indexes.
*/
rel = heap_open(AttributeRelationId, RowExclusiveLock);
rel = table_open(AttributeRelationId, RowExclusiveLock);
indstate = CatalogOpenIndexes(rel);
@ -776,7 +776,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
*/
CatalogCloseIndexes(indstate);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/* --------------------------------
@ -1070,7 +1070,7 @@ heap_create_with_catalog(const char *relname,
ObjectAddress new_type_addr;
Oid new_array_oid = InvalidOid;
pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock);
pg_class_desc = table_open(RelationRelationId, RowExclusiveLock);
/*
* sanity checks
@ -1376,8 +1376,8 @@ heap_create_with_catalog(const char *relname,
* ok, the relation has been cataloged, so close our relations and return
* the OID of the newly created relation.
*/
heap_close(new_rel_desc, NoLock); /* do not unlock till end of xact */
heap_close(pg_class_desc, RowExclusiveLock);
table_close(new_rel_desc, NoLock); /* do not unlock till end of xact */
table_close(pg_class_desc, RowExclusiveLock);
return relid;
}
@ -1420,7 +1420,7 @@ RelationRemoveInheritance(Oid relid)
ScanKeyData key;
HeapTuple tuple;
catalogRelation = heap_open(InheritsRelationId, RowExclusiveLock);
catalogRelation = table_open(InheritsRelationId, RowExclusiveLock);
ScanKeyInit(&key,
Anum_pg_inherits_inhrelid,
@ -1434,7 +1434,7 @@ RelationRemoveInheritance(Oid relid)
CatalogTupleDelete(catalogRelation, &tuple->t_self);
systable_endscan(scan);
heap_close(catalogRelation, RowExclusiveLock);
table_close(catalogRelation, RowExclusiveLock);
}
/*
@ -1452,7 +1452,7 @@ DeleteRelationTuple(Oid relid)
HeapTuple tup;
/* Grab an appropriate lock on the pg_class relation */
pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock);
pg_class_desc = table_open(RelationRelationId, RowExclusiveLock);
tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tup))
@ -1463,7 +1463,7 @@ DeleteRelationTuple(Oid relid)
ReleaseSysCache(tup);
heap_close(pg_class_desc, RowExclusiveLock);
table_close(pg_class_desc, RowExclusiveLock);
}
/*
@ -1483,7 +1483,7 @@ DeleteAttributeTuples(Oid relid)
HeapTuple atttup;
/* Grab an appropriate lock on the pg_attribute relation */
attrel = heap_open(AttributeRelationId, RowExclusiveLock);
attrel = table_open(AttributeRelationId, RowExclusiveLock);
/* Use the index to scan only attributes of the target relation */
ScanKeyInit(&key[0],
@ -1500,7 +1500,7 @@ DeleteAttributeTuples(Oid relid)
/* Clean up after the scan */
systable_endscan(scan);
heap_close(attrel, RowExclusiveLock);
table_close(attrel, RowExclusiveLock);
}
/*
@ -1520,7 +1520,7 @@ DeleteSystemAttributeTuples(Oid relid)
HeapTuple atttup;
/* Grab an appropriate lock on the pg_attribute relation */
attrel = heap_open(AttributeRelationId, RowExclusiveLock);
attrel = table_open(AttributeRelationId, RowExclusiveLock);
/* Use the index to scan only system attributes of the target relation */
ScanKeyInit(&key[0],
@ -1541,7 +1541,7 @@ DeleteSystemAttributeTuples(Oid relid)
/* Clean up after the scan */
systable_endscan(scan);
heap_close(attrel, RowExclusiveLock);
table_close(attrel, RowExclusiveLock);
}
/*
@ -1570,7 +1570,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
*/
rel = relation_open(relid, AccessExclusiveLock);
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(relid),
@ -1649,7 +1649,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
* backends of the change.
*/
heap_close(attr_rel, RowExclusiveLock);
table_close(attr_rel, RowExclusiveLock);
if (attnum > 0)
RemoveStatistics(relid, attnum);
@ -1673,7 +1673,7 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
HeapTuple tuple;
bool found = false;
attrdef_rel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
attrdef_rel = table_open(AttrDefaultRelationId, RowExclusiveLock);
ScanKeyInit(&scankeys[0],
Anum_pg_attrdef_adrelid,
@ -1704,7 +1704,7 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
}
systable_endscan(scan);
heap_close(attrdef_rel, RowExclusiveLock);
table_close(attrdef_rel, RowExclusiveLock);
if (complain && !found)
elog(ERROR, "could not find attrdef tuple for relation %u attnum %d",
@ -1731,7 +1731,7 @@ RemoveAttrDefaultById(Oid attrdefId)
AttrNumber myattnum;
/* Grab an appropriate lock on the pg_attrdef relation */
attrdef_rel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
attrdef_rel = table_open(AttrDefaultRelationId, RowExclusiveLock);
/* Find the pg_attrdef tuple */
ScanKeyInit(&scankeys[0],
@ -1756,10 +1756,10 @@ RemoveAttrDefaultById(Oid attrdefId)
CatalogTupleDelete(attrdef_rel, &tuple->t_self);
systable_endscan(scan);
heap_close(attrdef_rel, RowExclusiveLock);
table_close(attrdef_rel, RowExclusiveLock);
/* Fix the pg_attribute row */
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(myrelid),
@ -1776,7 +1776,7 @@ RemoveAttrDefaultById(Oid attrdefId)
* Our update of the pg_attribute row will force a relcache rebuild, so
* there's nothing else to do here.
*/
heap_close(attr_rel, RowExclusiveLock);
table_close(attr_rel, RowExclusiveLock);
/* Keep lock on attribute's rel until end of xact */
relation_close(myrel, NoLock);
@ -1856,7 +1856,7 @@ heap_drop_with_catalog(Oid relid)
Relation rel;
HeapTuple tuple;
rel = heap_open(ForeignTableRelationId, RowExclusiveLock);
rel = table_open(ForeignTableRelationId, RowExclusiveLock);
tuple = SearchSysCache1(FOREIGNTABLEREL, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
@ -1865,7 +1865,7 @@ heap_drop_with_catalog(Oid relid)
CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -1994,7 +1994,7 @@ RelationClearMissing(Relation rel)
/* Get a lock on pg_attribute */
attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
/* process each non-system attribute, including any dropped columns */
for (attnum = 1; attnum <= natts; attnum++)
@ -2026,7 +2026,7 @@ RelationClearMissing(Relation rel)
* Our update of the pg_attribute rows will force a relcache rebuild, so
* there's nothing else to do here.
*/
heap_close(attr_rel, RowExclusiveLock);
table_close(attr_rel, RowExclusiveLock);
}
/*
@ -2050,10 +2050,10 @@ SetAttrMissing(Oid relid, char *attname, char *value)
newtup;
/* lock the table the attribute belongs to */
tablerel = heap_open(relid, AccessExclusiveLock);
tablerel = table_open(relid, AccessExclusiveLock);
/* Lock the attribute row and get the data */
attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
attrrel = table_open(AttributeRelationId, RowExclusiveLock);
atttup = SearchSysCacheAttName(relid, attname);
if (!HeapTupleIsValid(atttup))
elog(ERROR, "cache lookup failed for attribute %s of relation %u",
@ -2082,8 +2082,8 @@ SetAttrMissing(Oid relid, char *attname, char *value)
/* clean up */
ReleaseSysCache(atttup);
heap_close(attrrel, RowExclusiveLock);
heap_close(tablerel, AccessExclusiveLock);
table_close(attrrel, RowExclusiveLock);
table_close(tablerel, AccessExclusiveLock);
}
/*
@ -2113,7 +2113,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
ObjectAddress colobject,
defobject;
adrel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
adrel = table_open(AttrDefaultRelationId, RowExclusiveLock);
/*
* Flatten expression to string form for storage.
@ -2137,7 +2137,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
defobject.objectId = attrdefOid;
defobject.objectSubId = 0;
heap_close(adrel, RowExclusiveLock);
table_close(adrel, RowExclusiveLock);
/* now can free some of the stuff allocated above */
pfree(DatumGetPointer(values[Anum_pg_attrdef_adbin - 1]));
@ -2148,7 +2148,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
* Update the pg_attribute entry for the column to show that a default
* exists.
*/
attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
attrrel = table_open(AttributeRelationId, RowExclusiveLock);
atttup = SearchSysCacheCopy2(ATTNUM,
ObjectIdGetDatum(RelationGetRelid(rel)),
Int16GetDatum(attnum));
@ -2222,7 +2222,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
pfree(DatumGetPointer(missingval));
}
heap_close(attrrel, RowExclusiveLock);
table_close(attrrel, RowExclusiveLock);
heap_freetuple(atttup);
/*
@ -2699,7 +2699,7 @@ MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
HeapTuple tup;
/* Search for a pg_constraint entry with same name and relation */
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
found = false;
@ -2821,7 +2821,7 @@ MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
}
systable_endscan(conscan);
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
return found;
}
@ -2843,7 +2843,7 @@ SetRelationNumChecks(Relation rel, int numchecks)
HeapTuple reltup;
Form_pg_class relStruct;
relrel = heap_open(RelationRelationId, RowExclusiveLock);
relrel = table_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(reltup))
@ -2864,7 +2864,7 @@ SetRelationNumChecks(Relation rel, int numchecks)
}
heap_freetuple(reltup);
heap_close(relrel, RowExclusiveLock);
table_close(relrel, RowExclusiveLock);
}
/*
@ -3001,7 +3001,7 @@ RemoveStatistics(Oid relid, AttrNumber attnum)
int nkeys;
HeapTuple tuple;
pgstatistic = heap_open(StatisticRelationId, RowExclusiveLock);
pgstatistic = table_open(StatisticRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_statistic_starelid,
@ -3028,7 +3028,7 @@ RemoveStatistics(Oid relid, AttrNumber attnum)
systable_endscan(scan);
heap_close(pgstatistic, RowExclusiveLock);
table_close(pgstatistic, RowExclusiveLock);
}
@ -3092,7 +3092,7 @@ heap_truncate(List *relids)
Oid rid = lfirst_oid(cell);
Relation rel;
rel = heap_open(rid, AccessExclusiveLock);
rel = table_open(rid, AccessExclusiveLock);
relations = lappend(relations, rel);
}
@ -3108,7 +3108,7 @@ heap_truncate(List *relids)
heap_truncate_one_rel(rel);
/* Close the relation, but keep exclusive lock on it until commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
}
@ -3143,12 +3143,12 @@ heap_truncate_one_rel(Relation rel)
toastrelid = rel->rd_rel->reltoastrelid;
if (OidIsValid(toastrelid))
{
Relation toastrel = heap_open(toastrelid, AccessExclusiveLock);
Relation toastrel = table_open(toastrelid, AccessExclusiveLock);
RelationTruncate(toastrel, 0);
RelationTruncateIndexes(toastrel);
/* keep the lock... */
heap_close(toastrel, NoLock);
table_close(toastrel, NoLock);
}
}
@ -3272,7 +3272,7 @@ heap_truncate_find_FKs(List *relationIds)
* Must scan pg_constraint. Right now, it is a seqscan because there is
* no available index on confrelid.
*/
fkeyRel = heap_open(ConstraintRelationId, AccessShareLock);
fkeyRel = table_open(ConstraintRelationId, AccessShareLock);
fkeyScan = systable_beginscan(fkeyRel, InvalidOid, false,
NULL, 0, NULL);
@ -3295,7 +3295,7 @@ heap_truncate_find_FKs(List *relationIds)
}
systable_endscan(fkeyScan);
heap_close(fkeyRel, AccessShareLock);
table_close(fkeyRel, AccessShareLock);
return result;
}
@ -3384,7 +3384,7 @@ StorePartitionKey(Relation rel,
else
partexprDatum = (Datum) 0;
pg_partitioned_table = heap_open(PartitionedRelationId, RowExclusiveLock);
pg_partitioned_table = table_open(PartitionedRelationId, RowExclusiveLock);
MemSet(nulls, false, sizeof(nulls));
@ -3404,7 +3404,7 @@ StorePartitionKey(Relation rel,
tuple = heap_form_tuple(RelationGetDescr(pg_partitioned_table), values, nulls);
CatalogTupleInsert(pg_partitioned_table, tuple);
heap_close(pg_partitioned_table, RowExclusiveLock);
table_close(pg_partitioned_table, RowExclusiveLock);
/* Mark this relation as dependent on a few things as follows */
myself.classId = RelationRelationId;
@ -3462,7 +3462,7 @@ RemovePartitionKeyByRelId(Oid relid)
Relation rel;
HeapTuple tuple;
rel = heap_open(PartitionedRelationId, RowExclusiveLock);
rel = table_open(PartitionedRelationId, RowExclusiveLock);
tuple = SearchSysCache1(PARTRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
@ -3472,7 +3472,7 @@ RemovePartitionKeyByRelId(Oid relid)
CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -3499,7 +3499,7 @@ StorePartitionBound(Relation rel, Relation parent, PartitionBoundSpec *bound)
Oid defaultPartOid;
/* Update pg_class tuple */
classRel = heap_open(RelationRelationId, RowExclusiveLock);
classRel = table_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(tuple))
@ -3532,7 +3532,7 @@ StorePartitionBound(Relation rel, Relation parent, PartitionBoundSpec *bound)
((Form_pg_class) GETSTRUCT(newtuple))->relispartition = true;
CatalogTupleUpdate(classRel, &newtuple->t_self, newtuple);
heap_freetuple(newtuple);
heap_close(classRel, RowExclusiveLock);
table_close(classRel, RowExclusiveLock);
/*
* If we're storing bounds for the default partition, update

View File

@ -527,7 +527,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
/*
* open the attribute relation and its indexes
*/
pg_attribute = heap_open(AttributeRelationId, RowExclusiveLock);
pg_attribute = table_open(AttributeRelationId, RowExclusiveLock);
indstate = CatalogOpenIndexes(pg_attribute);
@ -547,7 +547,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
CatalogCloseIndexes(indstate);
heap_close(pg_attribute, RowExclusiveLock);
table_close(pg_attribute, RowExclusiveLock);
}
/* ----------------------------------------------------------------
@ -625,7 +625,7 @@ UpdateIndexRelation(Oid indexoid,
/*
* open the system catalog index relation
*/
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
/*
* Build a pg_index tuple
@ -667,7 +667,7 @@ UpdateIndexRelation(Oid indexoid,
/*
* close the relation and free the tuple
*/
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
heap_freetuple(tuple);
}
@ -765,7 +765,7 @@ index_create(Relation heapRelation,
relkind = partitioned ? RELKIND_PARTITIONED_INDEX : RELKIND_INDEX;
is_exclusion = (indexInfo->ii_ExclusionOps != NULL);
pg_class = heap_open(RelationRelationId, RowExclusiveLock);
pg_class = table_open(RelationRelationId, RowExclusiveLock);
/*
* The index will be in the same namespace as its parent table, and is
@ -839,7 +839,7 @@ index_create(Relation heapRelation,
(errcode(ERRCODE_DUPLICATE_TABLE),
errmsg("relation \"%s\" already exists, skipping",
indexRelationName)));
heap_close(pg_class, RowExclusiveLock);
table_close(pg_class, RowExclusiveLock);
return InvalidOid;
}
@ -944,7 +944,7 @@ index_create(Relation heapRelation,
reloptions);
/* done with pg_class */
heap_close(pg_class, RowExclusiveLock);
table_close(pg_class, RowExclusiveLock);
/*
* now update the object id's of all the attribute tuple forms in the
@ -1403,7 +1403,7 @@ index_constraint_create(Relation heapRelation,
Form_pg_index indexForm;
bool dirty = false;
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexRelationId));
@ -1432,7 +1432,7 @@ index_constraint_create(Relation heapRelation,
}
heap_freetuple(indexTuple);
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
}
return referenced;
@ -1478,7 +1478,7 @@ index_drop(Oid indexId, bool concurrent)
*/
heapId = IndexGetRelation(indexId, false);
lockmode = concurrent ? ShareUpdateExclusiveLock : AccessExclusiveLock;
userHeapRelation = heap_open(heapId, lockmode);
userHeapRelation = table_open(heapId, lockmode);
userIndexRelation = index_open(indexId, lockmode);
/*
@ -1555,7 +1555,7 @@ index_drop(Oid indexId, bool concurrent)
SET_LOCKTAG_RELATION(heaplocktag, heaprelid.dbId, heaprelid.relId);
indexrelid = userIndexRelation->rd_lockInfo.lockRelId;
heap_close(userHeapRelation, NoLock);
table_close(userHeapRelation, NoLock);
index_close(userIndexRelation, NoLock);
/*
@ -1598,7 +1598,7 @@ index_drop(Oid indexId, bool concurrent)
* conflicts with existing predicate locks, so now is the time to move
* them to the heap relation.
*/
userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
userHeapRelation = table_open(heapId, ShareUpdateExclusiveLock);
userIndexRelation = index_open(indexId, ShareUpdateExclusiveLock);
TransferPredicateLocksToHeapRelation(userIndexRelation);
@ -1620,7 +1620,7 @@ index_drop(Oid indexId, bool concurrent)
/*
* Close the relations again, though still holding session lock.
*/
heap_close(userHeapRelation, NoLock);
table_close(userHeapRelation, NoLock);
index_close(userIndexRelation, NoLock);
/*
@ -1643,7 +1643,7 @@ index_drop(Oid indexId, bool concurrent)
* leave nothing to chance and grab AccessExclusiveLock on the index
* before the physical deletion.
*/
userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
userHeapRelation = table_open(heapId, ShareUpdateExclusiveLock);
userIndexRelation = index_open(indexId, AccessExclusiveLock);
}
else
@ -1670,7 +1670,7 @@ index_drop(Oid indexId, bool concurrent)
/*
* fix INDEX relation, and check for expressional index
*/
indexRelation = heap_open(IndexRelationId, RowExclusiveLock);
indexRelation = table_open(IndexRelationId, RowExclusiveLock);
tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(tuple))
@ -1682,7 +1682,7 @@ index_drop(Oid indexId, bool concurrent)
CatalogTupleDelete(indexRelation, &tuple->t_self);
ReleaseSysCache(tuple);
heap_close(indexRelation, RowExclusiveLock);
table_close(indexRelation, RowExclusiveLock);
/*
* if it has any expression columns, we might have stored statistics about
@ -1719,7 +1719,7 @@ index_drop(Oid indexId, bool concurrent)
/*
* Close owning rel, but keep lock
*/
heap_close(userHeapRelation, NoLock);
table_close(userHeapRelation, NoLock);
/*
* Release the session locks before we go.
@ -2119,7 +2119,7 @@ index_update_stats(Relation rel,
* what's really important.
*/
pg_class = heap_open(RelationRelationId, RowExclusiveLock);
pg_class = table_open(RelationRelationId, RowExclusiveLock);
/*
* Make a copy of the tuple to update. Normally we use the syscache, but
@ -2208,7 +2208,7 @@ index_update_stats(Relation rel,
heap_freetuple(tuple);
heap_close(pg_class, RowExclusiveLock);
table_close(pg_class, RowExclusiveLock);
}
@ -2349,7 +2349,7 @@ index_build(Relation heapRelation,
HeapTuple indexTuple;
Form_pg_index indexForm;
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId));
@ -2364,7 +2364,7 @@ index_build(Relation heapRelation,
CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
heap_freetuple(indexTuple);
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
}
/*
@ -3132,7 +3132,7 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
int save_nestlevel;
/* Open and lock the parent heap relation */
heapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
heapRelation = table_open(heapId, ShareUpdateExclusiveLock);
/* And the target index relation */
indexRelation = index_open(indexId, RowExclusiveLock);
@ -3208,7 +3208,7 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
/* Close rels, but keep locks */
index_close(indexRelation, NoLock);
heap_close(heapRelation, NoLock);
table_close(heapRelation, NoLock);
}
/*
@ -3530,7 +3530,7 @@ index_set_state_flags(Oid indexId, IndexStateFlagsAction action)
Assert(GetTopTransactionIdIfAny() == InvalidTransactionId);
/* Open pg_index and fetch a writable copy of the index's tuple */
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId));
@ -3590,7 +3590,7 @@ index_set_state_flags(Oid indexId, IndexStateFlagsAction action)
/* ... and write it back in-place */
heap_inplace_update(pg_index, indexTuple);
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
}
@ -3641,7 +3641,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
* we only need to be sure no schema or data changes are going on.
*/
heapId = IndexGetRelation(indexId, false);
heapRelation = heap_open(heapId, ShareLock);
heapRelation = table_open(heapId, ShareLock);
/*
* Open the target index relation and get an exclusive lock on it, to
@ -3755,7 +3755,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
bool index_bad;
bool early_pruning_enabled = EarlyPruningEnabled(heapRelation);
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
indexTuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId));
@ -3789,7 +3789,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
CacheInvalidateRelcache(heapRelation);
}
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
}
/* Log what we did */
@ -3802,7 +3802,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
/* Close rels, but keep locks */
index_close(iRel, NoLock);
heap_close(heapRelation, NoLock);
table_close(heapRelation, NoLock);
}
/*
@ -3854,7 +3854,7 @@ reindex_relation(Oid relid, int flags, int options)
* to prevent schema and data changes in it. The lock level used here
* should match ReindexTable().
*/
rel = heap_open(relid, ShareLock);
rel = table_open(relid, ShareLock);
/*
* This may be useful when implemented someday; but that day is not today.
@ -3868,7 +3868,7 @@ reindex_relation(Oid relid, int flags, int options)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("REINDEX of partitioned tables is not yet implemented, skipping \"%s\"",
RelationGetRelationName(rel))));
heap_close(rel, ShareLock);
table_close(rel, ShareLock);
return false;
}
@ -3969,7 +3969,7 @@ reindex_relation(Oid relid, int flags, int options)
/*
* Close rel, but continue to hold the lock.
*/
heap_close(rel, NoLock);
table_close(rel, NoLock);
result = (indexIds != NIL);

View File

@ -1338,9 +1338,9 @@ get_object_address_relobject(ObjectType objtype, List *object,
/* Extract relation name and open relation. */
relname = list_truncate(list_copy(object), nnames - 1);
relation = heap_openrv_extended(makeRangeVarFromNameList(relname),
AccessShareLock,
missing_ok);
relation = table_openrv_extended(makeRangeVarFromNameList(relname),
AccessShareLock,
missing_ok);
reloid = relation ? RelationGetRelid(relation) : InvalidOid;
@ -1380,7 +1380,7 @@ get_object_address_relobject(ObjectType objtype, List *object,
if (!OidIsValid(address.objectId))
{
if (relation != NULL)
heap_close(relation, AccessShareLock);
table_close(relation, AccessShareLock);
relation = NULL; /* department of accident prevention */
return address;
@ -2767,7 +2767,7 @@ getObjectDescription(const ObjectAddress *object)
HeapTuple tup;
Form_pg_cast castForm;
castDesc = heap_open(CastRelationId, AccessShareLock);
castDesc = table_open(CastRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_cast_oid,
@ -2790,7 +2790,7 @@ getObjectDescription(const ObjectAddress *object)
format_type_be(castForm->casttarget));
systable_endscan(rcscan);
heap_close(castDesc, AccessShareLock);
table_close(castDesc, AccessShareLock);
break;
}
@ -2888,7 +2888,7 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_attrdef attrdef;
ObjectAddress colobject;
attrdefDesc = heap_open(AttrDefaultRelationId, AccessShareLock);
attrdefDesc = table_open(AttrDefaultRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_attrdef_oid,
@ -2915,7 +2915,7 @@ getObjectDescription(const ObjectAddress *object)
getObjectDescription(&colobject));
systable_endscan(adscan);
heap_close(attrdefDesc, AccessShareLock);
table_close(attrdefDesc, AccessShareLock);
break;
}
@ -3000,8 +3000,8 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_amop amopForm;
StringInfoData opfam;
amopDesc = heap_open(AccessMethodOperatorRelationId,
AccessShareLock);
amopDesc = table_open(AccessMethodOperatorRelationId,
AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_amop_oid,
@ -3037,7 +3037,7 @@ getObjectDescription(const ObjectAddress *object)
pfree(opfam.data);
systable_endscan(amscan);
heap_close(amopDesc, AccessShareLock);
table_close(amopDesc, AccessShareLock);
break;
}
@ -3050,7 +3050,7 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_amproc amprocForm;
StringInfoData opfam;
amprocDesc = heap_open(AccessMethodProcedureRelationId,
amprocDesc = table_open(AccessMethodProcedureRelationId,
AccessShareLock);
ScanKeyInit(&skey[0],
@ -3087,7 +3087,7 @@ getObjectDescription(const ObjectAddress *object)
pfree(opfam.data);
systable_endscan(amscan);
heap_close(amprocDesc, AccessShareLock);
table_close(amprocDesc, AccessShareLock);
break;
}
@ -3100,7 +3100,7 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_rewrite rule;
StringInfoData rel;
ruleDesc = heap_open(RewriteRelationId, AccessShareLock);
ruleDesc = table_open(RewriteRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_rewrite_oid,
@ -3125,7 +3125,7 @@ getObjectDescription(const ObjectAddress *object)
NameStr(rule->rulename), rel.data);
pfree(rel.data);
systable_endscan(rcscan);
heap_close(ruleDesc, AccessShareLock);
table_close(ruleDesc, AccessShareLock);
break;
}
@ -3138,7 +3138,7 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_trigger trig;
StringInfoData rel;
trigDesc = heap_open(TriggerRelationId, AccessShareLock);
trigDesc = table_open(TriggerRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_trigger_oid,
@ -3163,7 +3163,7 @@ getObjectDescription(const ObjectAddress *object)
NameStr(trig->tgname), rel.data);
pfree(rel.data);
systable_endscan(tgscan);
heap_close(trigDesc, AccessShareLock);
table_close(trigDesc, AccessShareLock);
break;
}
@ -3398,7 +3398,7 @@ getObjectDescription(const ObjectAddress *object)
char *rolename;
char *nspname;
defaclrel = heap_open(DefaultAclRelationId, AccessShareLock);
defaclrel = table_open(DefaultAclRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_default_acl_oid,
@ -3485,7 +3485,7 @@ getObjectDescription(const ObjectAddress *object)
}
systable_endscan(rcscan);
heap_close(defaclrel, AccessShareLock);
table_close(defaclrel, AccessShareLock);
break;
}
@ -3525,7 +3525,7 @@ getObjectDescription(const ObjectAddress *object)
Form_pg_policy form_policy;
StringInfoData rel;
policy_rel = heap_open(PolicyRelationId, AccessShareLock);
policy_rel = table_open(PolicyRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_policy_oid,
@ -3550,7 +3550,7 @@ getObjectDescription(const ObjectAddress *object)
NameStr(form_policy->polname), rel.data);
pfree(rel.data);
systable_endscan(sscan);
heap_close(policy_rel, AccessShareLock);
table_close(policy_rel, AccessShareLock);
break;
}
@ -3817,7 +3817,7 @@ pg_identify_object(PG_FUNCTION_ARGS)
if (is_objectclass_supported(address.classId))
{
HeapTuple objtup;
Relation catalog = heap_open(address.classId, AccessShareLock);
Relation catalog = table_open(address.classId, AccessShareLock);
objtup = get_catalog_object_by_oid(catalog,
get_object_attnum_oid(address.classId),
@ -3859,7 +3859,7 @@ pg_identify_object(PG_FUNCTION_ARGS)
}
}
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
}
/* object type */
@ -4197,7 +4197,7 @@ getConstraintTypeDescription(StringInfo buffer, Oid constroid)
HeapTuple constrTup;
Form_pg_constraint constrForm;
constrRel = heap_open(ConstraintRelationId, AccessShareLock);
constrRel = table_open(ConstraintRelationId, AccessShareLock);
constrTup = get_catalog_object_by_oid(constrRel, Anum_pg_constraint_oid,
constroid);
if (!HeapTupleIsValid(constrTup))
@ -4212,7 +4212,7 @@ getConstraintTypeDescription(StringInfo buffer, Oid constroid)
else
elog(ERROR, "invalid constraint %u", constrForm->oid);
heap_close(constrRel, AccessShareLock);
table_close(constrRel, AccessShareLock);
}
/*
@ -4321,7 +4321,7 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple tup;
Form_pg_cast castForm;
castRel = heap_open(CastRelationId, AccessShareLock);
castRel = table_open(CastRelationId, AccessShareLock);
tup = get_catalog_object_by_oid(castRel, Anum_pg_cast_oid,
object->objectId);
@ -4342,7 +4342,7 @@ getObjectIdentityParts(const ObjectAddress *object,
*objargs = list_make1(format_type_be_qualified(castForm->casttarget));
}
heap_close(castRel, AccessShareLock);
table_close(castRel, AccessShareLock);
break;
}
@ -4443,7 +4443,7 @@ getObjectIdentityParts(const ObjectAddress *object,
Form_pg_attrdef attrdef;
ObjectAddress colobject;
attrdefDesc = heap_open(AttrDefaultRelationId, AccessShareLock);
attrdefDesc = table_open(AttrDefaultRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_attrdef_oid,
@ -4470,7 +4470,7 @@ getObjectIdentityParts(const ObjectAddress *object,
objname, objargs));
systable_endscan(adscan);
heap_close(attrdefDesc, AccessShareLock);
table_close(attrdefDesc, AccessShareLock);
break;
}
@ -4572,8 +4572,8 @@ getObjectIdentityParts(const ObjectAddress *object,
char *ltype;
char *rtype;
amopDesc = heap_open(AccessMethodOperatorRelationId,
AccessShareLock);
amopDesc = table_open(AccessMethodOperatorRelationId,
AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_amop_oid,
@ -4611,7 +4611,7 @@ getObjectIdentityParts(const ObjectAddress *object,
pfree(opfam.data);
systable_endscan(amscan);
heap_close(amopDesc, AccessShareLock);
table_close(amopDesc, AccessShareLock);
break;
}
@ -4626,8 +4626,8 @@ getObjectIdentityParts(const ObjectAddress *object,
char *ltype;
char *rtype;
amprocDesc = heap_open(AccessMethodProcedureRelationId,
AccessShareLock);
amprocDesc = table_open(AccessMethodProcedureRelationId,
AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_amproc_oid,
@ -4665,7 +4665,7 @@ getObjectIdentityParts(const ObjectAddress *object,
pfree(opfam.data);
systable_endscan(amscan);
heap_close(amprocDesc, AccessShareLock);
table_close(amprocDesc, AccessShareLock);
break;
}
@ -4675,7 +4675,7 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple tup;
Form_pg_rewrite rule;
ruleDesc = heap_open(RewriteRelationId, AccessShareLock);
ruleDesc = table_open(RewriteRelationId, AccessShareLock);
tup = get_catalog_object_by_oid(ruleDesc, Anum_pg_rewrite_oid,
object->objectId);
@ -4692,7 +4692,7 @@ getObjectIdentityParts(const ObjectAddress *object,
if (objname)
*objname = lappend(*objname, pstrdup(NameStr(rule->rulename)));
heap_close(ruleDesc, AccessShareLock);
table_close(ruleDesc, AccessShareLock);
break;
}
@ -4702,7 +4702,7 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple tup;
Form_pg_trigger trig;
trigDesc = heap_open(TriggerRelationId, AccessShareLock);
trigDesc = table_open(TriggerRelationId, AccessShareLock);
tup = get_catalog_object_by_oid(trigDesc, Anum_pg_trigger_oid,
object->objectId);
@ -4719,7 +4719,7 @@ getObjectIdentityParts(const ObjectAddress *object,
if (objname)
*objname = lappend(*objname, pstrdup(NameStr(trig->tgname)));
heap_close(trigDesc, AccessShareLock);
table_close(trigDesc, AccessShareLock);
break;
}
@ -4964,7 +4964,7 @@ getObjectIdentityParts(const ObjectAddress *object,
char *schema;
char *username;
defaclrel = heap_open(DefaultAclRelationId, AccessShareLock);
defaclrel = table_open(DefaultAclRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_default_acl_oid,
@ -5030,7 +5030,7 @@ getObjectIdentityParts(const ObjectAddress *object,
}
systable_endscan(rcscan);
heap_close(defaclrel, AccessShareLock);
table_close(defaclrel, AccessShareLock);
break;
}
@ -5075,7 +5075,7 @@ getObjectIdentityParts(const ObjectAddress *object,
HeapTuple tup;
Form_pg_policy policy;
polDesc = heap_open(PolicyRelationId, AccessShareLock);
polDesc = table_open(PolicyRelationId, AccessShareLock);
tup = get_catalog_object_by_oid(polDesc, Anum_pg_policy_oid,
object->objectId);
@ -5092,7 +5092,7 @@ getObjectIdentityParts(const ObjectAddress *object,
if (objname)
*objname = lappend(*objname, pstrdup(NameStr(policy->polname)));
heap_close(polDesc, AccessShareLock);
table_close(polDesc, AccessShareLock);
break;
}
@ -5153,7 +5153,7 @@ getObjectIdentityParts(const ObjectAddress *object,
char *transformLang;
char *transformType;
transformDesc = heap_open(TransformRelationId, AccessShareLock);
transformDesc = table_open(TransformRelationId, AccessShareLock);
tup = get_catalog_object_by_oid(transformDesc,
Anum_pg_transform_oid,
@ -5177,7 +5177,7 @@ getObjectIdentityParts(const ObjectAddress *object,
*objargs = list_make1(pstrdup(transformLang));
}
heap_close(transformDesc, AccessShareLock);
table_close(transformDesc, AccessShareLock);
}
break;

View File

@ -55,14 +55,14 @@ get_partition_parent(Oid relid)
Relation catalogRelation;
Oid result;
catalogRelation = heap_open(InheritsRelationId, AccessShareLock);
catalogRelation = table_open(InheritsRelationId, AccessShareLock);
result = get_partition_parent_worker(catalogRelation, relid);
if (!OidIsValid(result))
elog(ERROR, "could not find tuple for parent of relation %u", relid);
heap_close(catalogRelation, AccessShareLock);
table_close(catalogRelation, AccessShareLock);
return result;
}
@ -120,11 +120,11 @@ get_partition_ancestors(Oid relid)
List *result = NIL;
Relation inhRel;
inhRel = heap_open(InheritsRelationId, AccessShareLock);
inhRel = table_open(InheritsRelationId, AccessShareLock);
get_partition_ancestors_worker(inhRel, relid, &result);
heap_close(inhRel, AccessShareLock);
table_close(inhRel, AccessShareLock);
return result;
}
@ -310,7 +310,7 @@ update_default_partition_oid(Oid parentId, Oid defaultPartId)
Relation pg_partitioned_table;
Form_pg_partitioned_table part_table_form;
pg_partitioned_table = heap_open(PartitionedRelationId, RowExclusiveLock);
pg_partitioned_table = table_open(PartitionedRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(PARTRELID, ObjectIdGetDatum(parentId));
@ -323,7 +323,7 @@ update_default_partition_oid(Oid parentId, Oid defaultPartId)
CatalogTupleUpdate(pg_partitioned_table, &tuple->t_self, tuple);
heap_freetuple(tuple);
heap_close(pg_partitioned_table, RowExclusiveLock);
table_close(pg_partitioned_table, RowExclusiveLock);
}
/*

View File

@ -639,7 +639,7 @@ AggregateCreate(const char *aggName,
/*
* Okay to create the pg_aggregate entry.
*/
aggdesc = heap_open(AggregateRelationId, RowExclusiveLock);
aggdesc = table_open(AggregateRelationId, RowExclusiveLock);
tupDesc = aggdesc->rd_att;
/* initialize nulls and values */
@ -680,7 +680,7 @@ AggregateCreate(const char *aggName,
tup = heap_form_tuple(tupDesc, values, nulls);
CatalogTupleInsert(aggdesc, tup);
heap_close(aggdesc, RowExclusiveLock);
table_close(aggdesc, RowExclusiveLock);
/*
* Create dependencies for the aggregate (above and beyond those already

View File

@ -107,7 +107,7 @@ CollationCreate(const char *collname, Oid collnamespace,
}
/* open pg_collation; see below about the lock level */
rel = heap_open(CollationRelationId, ShareRowExclusiveLock);
rel = table_open(CollationRelationId, ShareRowExclusiveLock);
/*
* Also forbid a specific-encoding collation shadowing an any-encoding
@ -129,12 +129,12 @@ CollationCreate(const char *collname, Oid collnamespace,
{
if (quiet)
{
heap_close(rel, NoLock);
table_close(rel, NoLock);
return InvalidOid;
}
else if (if_not_exists)
{
heap_close(rel, NoLock);
table_close(rel, NoLock);
ereport(NOTICE,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("collation \"%s\" already exists, skipping",
@ -198,7 +198,7 @@ CollationCreate(const char *collname, Oid collnamespace,
InvokeObjectPostCreateHook(CollationRelationId, oid, 0);
heap_freetuple(tup);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return oid;
}
@ -217,7 +217,7 @@ RemoveCollationById(Oid collationOid)
SysScanDesc scandesc;
HeapTuple tuple;
rel = heap_open(CollationRelationId, RowExclusiveLock);
rel = table_open(CollationRelationId, RowExclusiveLock);
ScanKeyInit(&scanKeyData,
Anum_pg_collation_oid,
@ -236,5 +236,5 @@ RemoveCollationById(Oid collationOid)
systable_endscan(scandesc);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}

View File

@ -95,7 +95,7 @@ CreateConstraintEntry(const char *constraintName,
int i;
ObjectAddress conobject;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
Assert(constraintName);
namestrcpy(&cname, constraintName);
@ -230,7 +230,7 @@ CreateConstraintEntry(const char *constraintName,
conobject.objectId = conOid;
conobject.objectSubId = 0;
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
if (OidIsValid(relId))
{
@ -394,7 +394,7 @@ ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
SysScanDesc conscan;
ScanKeyData skey[3];
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -418,7 +418,7 @@ ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
found = (HeapTupleIsValid(systable_getnext(conscan)));
systable_endscan(conscan);
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return found;
}
@ -438,7 +438,7 @@ ConstraintNameExists(const char *conname, Oid namespaceid)
SysScanDesc conscan;
ScanKeyData skey[2];
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conname,
@ -456,7 +456,7 @@ ConstraintNameExists(const char *conname, Oid namespaceid)
found = (HeapTupleIsValid(systable_getnext(conscan)));
systable_endscan(conscan);
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return found;
}
@ -498,7 +498,7 @@ ChooseConstraintName(const char *name1, const char *name2,
bool found;
ListCell *l;
conDesc = heap_open(ConstraintRelationId, AccessShareLock);
conDesc = table_open(ConstraintRelationId, AccessShareLock);
/* try the unmodified label first */
StrNCpy(modlabel, label, sizeof(modlabel));
@ -546,7 +546,7 @@ ChooseConstraintName(const char *name1, const char *name2,
snprintf(modlabel, sizeof(modlabel), "%s%d", label, ++pass);
}
heap_close(conDesc, AccessShareLock);
table_close(conDesc, AccessShareLock);
return conname;
}
@ -561,7 +561,7 @@ RemoveConstraintById(Oid conId)
HeapTuple tup;
Form_pg_constraint con;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -579,7 +579,7 @@ RemoveConstraintById(Oid conId)
* If the constraint is for a relation, open and exclusive-lock the
* relation it's for.
*/
rel = heap_open(con->conrelid, AccessExclusiveLock);
rel = table_open(con->conrelid, AccessExclusiveLock);
/*
* We need to update the relcheck count if it is a check constraint
@ -592,7 +592,7 @@ RemoveConstraintById(Oid conId)
HeapTuple relTup;
Form_pg_class classForm;
pgrel = heap_open(RelationRelationId, RowExclusiveLock);
pgrel = table_open(RelationRelationId, RowExclusiveLock);
relTup = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(con->conrelid));
if (!HeapTupleIsValid(relTup))
@ -609,11 +609,11 @@ RemoveConstraintById(Oid conId)
heap_freetuple(relTup);
heap_close(pgrel, RowExclusiveLock);
table_close(pgrel, RowExclusiveLock);
}
/* Keep lock on constraint's rel until end of xact */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
else if (OidIsValid(con->contypid))
{
@ -632,7 +632,7 @@ RemoveConstraintById(Oid conId)
/* Clean up */
ReleaseSysCache(tup);
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
}
/*
@ -652,7 +652,7 @@ RenameConstraintById(Oid conId, const char *newname)
HeapTuple tuple;
Form_pg_constraint con;
conDesc = heap_open(ConstraintRelationId, RowExclusiveLock);
conDesc = table_open(ConstraintRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(CONSTROID, ObjectIdGetDatum(conId));
if (!HeapTupleIsValid(tuple))
@ -687,7 +687,7 @@ RenameConstraintById(Oid conId, const char *newname)
InvokeObjectPostAlterHook(ConstraintRelationId, conId, 0);
heap_freetuple(tuple);
heap_close(conDesc, RowExclusiveLock);
table_close(conDesc, RowExclusiveLock);
}
/*
@ -706,7 +706,7 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
SysScanDesc scan;
HeapTuple tup;
conRel = heap_open(ConstraintRelationId, RowExclusiveLock);
conRel = table_open(ConstraintRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_constraint_conrelid,
@ -756,7 +756,7 @@ AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
systable_endscan(scan);
heap_close(conRel, RowExclusiveLock);
table_close(conRel, RowExclusiveLock);
}
/*
@ -776,7 +776,7 @@ ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId)
ObjectAddress depender;
ObjectAddress referenced;
constrRel = heap_open(ConstraintRelationId, RowExclusiveLock);
constrRel = table_open(ConstraintRelationId, RowExclusiveLock);
tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(childConstrId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for constraint %u", childConstrId);
@ -809,7 +809,7 @@ ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId)
}
ReleaseSysCache(tuple);
heap_close(constrRel, RowExclusiveLock);
table_close(constrRel, RowExclusiveLock);
}
@ -827,7 +827,7 @@ get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
ScanKeyData skey[3];
Oid conOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -858,7 +858,7 @@ get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
errmsg("constraint \"%s\" for table \"%s\" does not exist",
conname, get_rel_name(relid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conOid;
}
@ -888,7 +888,7 @@ get_relation_constraint_attnos(Oid relid, const char *conname,
/* Set *constraintOid, to avoid complaints about uninitialized vars */
*constraintOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -951,7 +951,7 @@ get_relation_constraint_attnos(Oid relid, const char *conname,
errmsg("constraint \"%s\" for table \"%s\" does not exist",
conname, get_rel_name(relid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conattnos;
}
@ -969,7 +969,7 @@ get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
HeapTuple tuple;
Oid constraintId = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&key,
Anum_pg_constraint_conrelid,
@ -991,7 +991,7 @@ get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
}
systable_endscan(scan);
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return constraintId;
}
@ -1009,7 +1009,7 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
ScanKeyData skey[3];
Oid conOid = InvalidOid;
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -1040,7 +1040,7 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok)
errmsg("constraint \"%s\" for domain %s does not exist",
conname, format_type_be(typid))));
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return conOid;
}
@ -1072,7 +1072,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
*constraintOid = InvalidOid;
/* Scan pg_constraint for constraints of the target rel */
pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -1133,7 +1133,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid)
systable_endscan(scan);
heap_close(pg_constraint, AccessShareLock);
table_close(pg_constraint, AccessShareLock);
return pkattnos;
}

View File

@ -83,7 +83,7 @@ ConversionCreate(const char *conname, Oid connamespace,
}
/* open pg_conversion */
rel = heap_open(ConversionRelationId, RowExclusiveLock);
rel = table_open(ConversionRelationId, RowExclusiveLock);
tupDesc = rel->rd_att;
/* initialize nulls and values */
@ -137,7 +137,7 @@ ConversionCreate(const char *conname, Oid connamespace,
InvokeObjectPostCreateHook(ConversionRelationId, oid, 0);
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return myself;
}
@ -162,7 +162,7 @@ RemoveConversionById(Oid conversionOid)
ObjectIdGetDatum(conversionOid));
/* open pg_conversion */
rel = heap_open(ConversionRelationId, RowExclusiveLock);
rel = table_open(ConversionRelationId, RowExclusiveLock);
scan = heap_beginscan_catalog(rel, 1, &scanKeyData);
@ -172,7 +172,7 @@ RemoveConversionById(Oid conversionOid)
else
elog(ERROR, "could not find tuple for conversion %u", conversionOid);
heap_endscan(scan);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*

View File

@ -33,7 +33,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
/* Get the old tuple, if any. */
rel = heap_open(DbRoleSettingRelationId, RowExclusiveLock);
rel = table_open(DbRoleSettingRelationId, RowExclusiveLock);
ScanKeyInit(&scankey[0],
Anum_pg_db_role_setting_setdatabase,
BTEqualStrategyNumber, F_OIDEQ,
@ -158,7 +158,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt *setstmt)
systable_endscan(scan);
/* Close pg_db_role_setting, but keep lock till commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -175,7 +175,7 @@ DropSetting(Oid databaseid, Oid roleid)
HeapTuple tup;
int numkeys = 0;
relsetting = heap_open(DbRoleSettingRelationId, RowExclusiveLock);
relsetting = table_open(DbRoleSettingRelationId, RowExclusiveLock);
if (OidIsValid(databaseid))
{
@ -203,7 +203,7 @@ DropSetting(Oid databaseid, Oid roleid)
}
heap_endscan(scan);
heap_close(relsetting, RowExclusiveLock);
table_close(relsetting, RowExclusiveLock);
}
/*

View File

@ -75,7 +75,7 @@ recordMultipleDependencies(const ObjectAddress *depender,
if (IsBootstrapProcessingMode())
return;
dependDesc = heap_open(DependRelationId, RowExclusiveLock);
dependDesc = table_open(DependRelationId, RowExclusiveLock);
/* Don't open indexes unless we need to make an update */
indstate = NULL;
@ -120,7 +120,7 @@ recordMultipleDependencies(const ObjectAddress *depender,
if (indstate != NULL)
CatalogCloseIndexes(indstate);
heap_close(dependDesc, RowExclusiveLock);
table_close(dependDesc, RowExclusiveLock);
}
/*
@ -197,7 +197,7 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId,
SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, RowExclusiveLock);
depRel = table_open(DependRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
@ -223,7 +223,7 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId,
systable_endscan(scan);
heap_close(depRel, RowExclusiveLock);
table_close(depRel, RowExclusiveLock);
return count;
}
@ -247,7 +247,7 @@ deleteDependencyRecordsForClass(Oid classId, Oid objectId,
SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, RowExclusiveLock);
depRel = table_open(DependRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
@ -274,7 +274,7 @@ deleteDependencyRecordsForClass(Oid classId, Oid objectId,
systable_endscan(scan);
heap_close(depRel, RowExclusiveLock);
table_close(depRel, RowExclusiveLock);
return count;
}
@ -304,7 +304,7 @@ changeDependencyFor(Oid classId, Oid objectId,
ObjectAddress objAddr;
bool newIsPinned;
depRel = heap_open(DependRelationId, RowExclusiveLock);
depRel = table_open(DependRelationId, RowExclusiveLock);
/*
* If oldRefObjectId is pinned, there won't be any dependency entries on
@ -371,7 +371,7 @@ changeDependencyFor(Oid classId, Oid objectId,
systable_endscan(scan);
heap_close(depRel, RowExclusiveLock);
table_close(depRel, RowExclusiveLock);
return count;
}
@ -452,7 +452,7 @@ getExtensionOfObject(Oid classId, Oid objectId)
SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
@ -480,7 +480,7 @@ getExtensionOfObject(Oid classId, Oid objectId)
systable_endscan(scan);
heap_close(depRel, AccessShareLock);
table_close(depRel, AccessShareLock);
return result;
}
@ -505,7 +505,7 @@ sequenceIsOwned(Oid seqId, char deptype, Oid *tableId, int32 *colId)
SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
@ -535,7 +535,7 @@ sequenceIsOwned(Oid seqId, char deptype, Oid *tableId, int32 *colId)
systable_endscan(scan);
heap_close(depRel, AccessShareLock);
table_close(depRel, AccessShareLock);
return ret;
}
@ -553,7 +553,7 @@ getOwnedSequences(Oid relid, AttrNumber attnum)
SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
@ -593,7 +593,7 @@ getOwnedSequences(Oid relid, AttrNumber attnum)
systable_endscan(scan);
heap_close(depRel, AccessShareLock);
table_close(depRel, AccessShareLock);
return result;
}
@ -632,7 +632,7 @@ get_constraint_index(Oid constraintId)
HeapTuple tup;
/* Search the dependency table for the dependent index */
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
@ -675,7 +675,7 @@ get_constraint_index(Oid constraintId)
}
systable_endscan(scan);
heap_close(depRel, AccessShareLock);
table_close(depRel, AccessShareLock);
return indexId;
}
@ -695,7 +695,7 @@ get_index_constraint(Oid indexId)
HeapTuple tup;
/* Search the dependency table for the index */
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
@ -731,7 +731,7 @@ get_index_constraint(Oid indexId)
}
systable_endscan(scan);
heap_close(depRel, AccessShareLock);
table_close(depRel, AccessShareLock);
return constraintId;
}

View File

@ -79,7 +79,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
* probably not worth trying harder.
*/
pg_enum = heap_open(EnumRelationId, RowExclusiveLock);
pg_enum = table_open(EnumRelationId, RowExclusiveLock);
/*
* Allocate OIDs for the enum's members.
@ -146,7 +146,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
/* clean up */
pfree(oids);
heap_close(pg_enum, RowExclusiveLock);
table_close(pg_enum, RowExclusiveLock);
}
@ -162,7 +162,7 @@ EnumValuesDelete(Oid enumTypeOid)
SysScanDesc scan;
HeapTuple tup;
pg_enum = heap_open(EnumRelationId, RowExclusiveLock);
pg_enum = table_open(EnumRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_enum_enumtypid,
@ -179,7 +179,7 @@ EnumValuesDelete(Oid enumTypeOid)
systable_endscan(scan);
heap_close(pg_enum, RowExclusiveLock);
table_close(pg_enum, RowExclusiveLock);
}
/*
@ -269,7 +269,7 @@ AddEnumLabel(Oid enumTypeOid,
newVal)));
}
pg_enum = heap_open(EnumRelationId, RowExclusiveLock);
pg_enum = table_open(EnumRelationId, RowExclusiveLock);
/* If we have to renumber the existing members, we restart from here */
restart:
@ -491,7 +491,7 @@ restart:
CatalogTupleInsert(pg_enum, enum_tup);
heap_freetuple(enum_tup);
heap_close(pg_enum, RowExclusiveLock);
table_close(pg_enum, RowExclusiveLock);
/* Set up the blacklist hash if not already done in this transaction */
if (enum_blacklist == NULL)
@ -537,7 +537,7 @@ RenameEnumLabel(Oid enumTypeOid,
*/
LockDatabaseObject(TypeRelationId, enumTypeOid, 0, ExclusiveLock);
pg_enum = heap_open(EnumRelationId, RowExclusiveLock);
pg_enum = table_open(EnumRelationId, RowExclusiveLock);
/* Get the list of existing members of the enum */
list = SearchSysCacheList1(ENUMTYPOIDNAME,
@ -582,7 +582,7 @@ RenameEnumLabel(Oid enumTypeOid,
CatalogTupleUpdate(pg_enum, &enum_tup->t_self, enum_tup);
heap_freetuple(enum_tup);
heap_close(pg_enum, RowExclusiveLock);
table_close(pg_enum, RowExclusiveLock);
}

View File

@ -80,7 +80,7 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
oidarr = (Oid *) palloc(maxoids * sizeof(Oid));
numoids = 0;
relation = heap_open(InheritsRelationId, AccessShareLock);
relation = table_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_inherits_inhparent,
@ -103,7 +103,7 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
systable_endscan(scan);
heap_close(relation, AccessShareLock);
table_close(relation, AccessShareLock);
/*
* If we found more than one child, sort them by OID. This ensures
@ -285,14 +285,14 @@ has_superclass(Oid relationId)
ScanKeyData skey;
bool result;
catalog = heap_open(InheritsRelationId, AccessShareLock);
catalog = table_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&skey, Anum_pg_inherits_inhrelid, BTEqualStrategyNumber,
F_OIDEQ, ObjectIdGetDatum(relationId));
scan = systable_beginscan(catalog, InheritsRelidSeqnoIndexId, true,
NULL, 1, &skey);
result = HeapTupleIsValid(systable_getnext(scan));
systable_endscan(scan);
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
return result;
}
@ -335,7 +335,7 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
queue = list_make1_oid(subclassRelid);
visited = NIL;
inhrel = heap_open(InheritsRelationId, AccessShareLock);
inhrel = table_open(InheritsRelationId, AccessShareLock);
/*
* Use queue to do a breadth-first traversal of the inheritance graph from
@ -397,7 +397,7 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
}
/* clean up ... */
heap_close(inhrel, AccessShareLock);
table_close(inhrel, AccessShareLock);
list_free(visited);
list_free(queue);
@ -416,7 +416,7 @@ StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
HeapTuple tuple;
Relation inhRelation;
inhRelation = heap_open(InheritsRelationId, RowExclusiveLock);
inhRelation = table_open(InheritsRelationId, RowExclusiveLock);
/*
* Make the pg_inherits entry
@ -433,7 +433,7 @@ StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
heap_freetuple(tuple);
heap_close(inhRelation, RowExclusiveLock);
table_close(inhRelation, RowExclusiveLock);
}
/*
@ -457,7 +457,7 @@ DeleteInheritsTuple(Oid inhrelid, Oid inhparent)
/*
* Find pg_inherits entries by inhrelid.
*/
catalogRelation = heap_open(InheritsRelationId, RowExclusiveLock);
catalogRelation = table_open(InheritsRelationId, RowExclusiveLock);
ScanKeyInit(&key,
Anum_pg_inherits_inhrelid,
BTEqualStrategyNumber, F_OIDEQ,
@ -480,7 +480,7 @@ DeleteInheritsTuple(Oid inhrelid, Oid inhparent)
/* Done */
systable_endscan(scan);
heap_close(catalogRelation, RowExclusiveLock);
table_close(catalogRelation, RowExclusiveLock);
return found;
}

View File

@ -46,8 +46,8 @@ LargeObjectCreate(Oid loid)
Datum values[Natts_pg_largeobject_metadata];
bool nulls[Natts_pg_largeobject_metadata];
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
/*
* Insert metadata of the largeobject
@ -74,7 +74,7 @@ LargeObjectCreate(Oid loid)
heap_freetuple(ntup);
heap_close(pg_lo_meta, RowExclusiveLock);
table_close(pg_lo_meta, RowExclusiveLock);
return loid_new;
}
@ -92,11 +92,11 @@ LargeObjectDrop(Oid loid)
SysScanDesc scan;
HeapTuple tuple;
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
RowExclusiveLock);
pg_largeobject = heap_open(LargeObjectRelationId,
RowExclusiveLock);
pg_largeobject = table_open(LargeObjectRelationId,
RowExclusiveLock);
/*
* Delete an entry from pg_largeobject_metadata
@ -138,9 +138,9 @@ LargeObjectDrop(Oid loid)
systable_endscan(scan);
heap_close(pg_largeobject, RowExclusiveLock);
table_close(pg_largeobject, RowExclusiveLock);
heap_close(pg_lo_meta, RowExclusiveLock);
table_close(pg_lo_meta, RowExclusiveLock);
}
/*
@ -169,8 +169,8 @@ LargeObjectExists(Oid loid)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(loid));
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
AccessShareLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
AccessShareLock);
sd = systable_beginscan(pg_lo_meta,
LargeObjectMetadataOidIndexId, true,
@ -182,7 +182,7 @@ LargeObjectExists(Oid loid)
systable_endscan(sd);
heap_close(pg_lo_meta, AccessShareLock);
table_close(pg_lo_meta, AccessShareLock);
return retval;
}

View File

@ -69,7 +69,7 @@ NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)
else
nspacl = NULL;
nspdesc = heap_open(NamespaceRelationId, RowExclusiveLock);
nspdesc = table_open(NamespaceRelationId, RowExclusiveLock);
tupDesc = nspdesc->rd_att;
/* initialize nulls and values */
@ -96,7 +96,7 @@ NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp)
CatalogTupleInsert(nspdesc, tup);
Assert(OidIsValid(nspoid));
heap_close(nspdesc, RowExclusiveLock);
table_close(nspdesc, RowExclusiveLock);
/* Record dependencies */
myself.classId = NamespaceRelationId;

View File

@ -222,7 +222,7 @@ OperatorShellMake(const char *operatorName,
/*
* open pg_operator
*/
pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
pg_operator_desc = table_open(OperatorRelationId, RowExclusiveLock);
tupDesc = pg_operator_desc->rd_att;
/*
@ -283,7 +283,7 @@ OperatorShellMake(const char *operatorName,
/*
* close the operator relation and return the oid.
*/
heap_close(pg_operator_desc, RowExclusiveLock);
table_close(pg_operator_desc, RowExclusiveLock);
return operatorObjectId;
}
@ -506,7 +506,7 @@ OperatorCreate(const char *operatorName,
values[Anum_pg_operator_oprrest - 1] = ObjectIdGetDatum(restrictionId);
values[Anum_pg_operator_oprjoin - 1] = ObjectIdGetDatum(joinId);
pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
pg_operator_desc = table_open(OperatorRelationId, RowExclusiveLock);
/*
* If we are replacing an operator shell, update; else insert
@ -551,7 +551,7 @@ OperatorCreate(const char *operatorName,
/* Post creation hook for new operator */
InvokeObjectPostCreateHook(OperatorRelationId, operatorObjectId, 0);
heap_close(pg_operator_desc, RowExclusiveLock);
table_close(pg_operator_desc, RowExclusiveLock);
/*
* If a commutator and/or negator link is provided, update the other
@ -666,7 +666,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete)
CommandCounterIncrement();
/* Open the relation. */
pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
pg_operator_desc = table_open(OperatorRelationId, RowExclusiveLock);
/* Get a writable copy of the commutator's tuple. */
if (OidIsValid(commId))
@ -758,7 +758,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete)
}
/* Close relation and release catalog lock. */
heap_close(pg_operator_desc, RowExclusiveLock);
table_close(pg_operator_desc, RowExclusiveLock);
}
/*

View File

@ -362,7 +362,7 @@ ProcedureCreate(const char *procedureName,
nulls[Anum_pg_proc_proconfig - 1] = true;
/* proacl will be determined later */
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
rel = table_open(ProcedureRelationId, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
/* Check for pre-existing definition */
@ -673,7 +673,7 @@ ProcedureCreate(const char *procedureName,
/* Post creation hook for new function */
InvokeObjectPostCreateHook(ProcedureRelationId, retval, 0);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
/* Verify function body */
if (OidIsValid(languageValidator))

View File

@ -155,7 +155,7 @@ publication_add_relation(Oid pubid, Relation targetrel,
ObjectAddress myself,
referenced;
rel = heap_open(PublicationRelRelationId, RowExclusiveLock);
rel = table_open(PublicationRelRelationId, RowExclusiveLock);
/*
* Check for duplicates. Note that this does not really prevent
@ -165,7 +165,7 @@ publication_add_relation(Oid pubid, Relation targetrel,
if (SearchSysCacheExists2(PUBLICATIONRELMAP, ObjectIdGetDatum(relid),
ObjectIdGetDatum(pubid)))
{
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
if (if_not_exists)
return InvalidObjectAddress;
@ -207,7 +207,7 @@ publication_add_relation(Oid pubid, Relation targetrel,
recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
/* Close the table. */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
/* Invalidate relcache so that publication info is rebuilt. */
CacheInvalidateRelcache(targetrel);
@ -258,7 +258,7 @@ GetPublicationRelations(Oid pubid)
HeapTuple tup;
/* Find all publications associated with the relation. */
pubrelsrel = heap_open(PublicationRelRelationId, AccessShareLock);
pubrelsrel = table_open(PublicationRelRelationId, AccessShareLock);
ScanKeyInit(&scankey,
Anum_pg_publication_rel_prpubid,
@ -279,7 +279,7 @@ GetPublicationRelations(Oid pubid)
}
systable_endscan(scan);
heap_close(pubrelsrel, AccessShareLock);
table_close(pubrelsrel, AccessShareLock);
return result;
}
@ -297,7 +297,7 @@ GetAllTablesPublications(void)
HeapTuple tup;
/* Find all publications that are marked as for all tables. */
rel = heap_open(PublicationRelationId, AccessShareLock);
rel = table_open(PublicationRelationId, AccessShareLock);
ScanKeyInit(&scankey,
Anum_pg_publication_puballtables,
@ -316,7 +316,7 @@ GetAllTablesPublications(void)
}
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return result;
}
@ -333,7 +333,7 @@ GetAllTablesPublicationRelations(void)
HeapTuple tuple;
List *result = NIL;
classRel = heap_open(RelationRelationId, AccessShareLock);
classRel = table_open(RelationRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_class_relkind,
@ -352,7 +352,7 @@ GetAllTablesPublicationRelations(void)
}
heap_endscan(scan);
heap_close(classRel, AccessShareLock);
table_close(classRel, AccessShareLock);
return result;
}

View File

@ -45,7 +45,7 @@ RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation,
ObjectAddress myself;
ObjectAddress referenced;
pg_range = heap_open(RangeRelationId, RowExclusiveLock);
pg_range = table_open(RangeRelationId, RowExclusiveLock);
memset(nulls, 0, sizeof(nulls));
@ -101,7 +101,7 @@ RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation,
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
heap_close(pg_range, RowExclusiveLock);
table_close(pg_range, RowExclusiveLock);
}
@ -117,7 +117,7 @@ RangeDelete(Oid rangeTypeOid)
SysScanDesc scan;
HeapTuple tup;
pg_range = heap_open(RangeRelationId, RowExclusiveLock);
pg_range = table_open(RangeRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
Anum_pg_range_rngtypid,
@ -134,5 +134,5 @@ RangeDelete(Oid rangeTypeOid)
systable_endscan(scan);
heap_close(pg_range, RowExclusiveLock);
table_close(pg_range, RowExclusiveLock);
}

View File

@ -131,7 +131,7 @@ recordSharedDependencyOn(ObjectAddress *depender,
if (IsBootstrapProcessingMode())
return;
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
/* If the referenced object is pinned, do nothing. */
if (!isSharedObjectPinned(referenced->classId, referenced->objectId,
@ -143,7 +143,7 @@ recordSharedDependencyOn(ObjectAddress *depender,
deptype);
}
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
/*
@ -305,7 +305,7 @@ changeDependencyOnOwner(Oid classId, Oid objectId, Oid newOwnerId)
{
Relation sdepRel;
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
/* Adjust the SHARED_DEPENDENCY_OWNER entry */
shdepChangeDep(sdepRel,
@ -336,7 +336,7 @@ changeDependencyOnOwner(Oid classId, Oid objectId, Oid newOwnerId)
AuthIdRelationId, newOwnerId,
SHARED_DEPENDENCY_ACL);
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
/*
@ -436,7 +436,7 @@ updateAclDependencies(Oid classId, Oid objectId, int32 objsubId,
if (noldmembers > 0 || nnewmembers > 0)
{
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
/* Add new dependencies that weren't already present */
for (i = 0; i < nnewmembers; i++)
@ -479,7 +479,7 @@ updateAclDependencies(Oid classId, Oid objectId, int32 objsubId,
SHARED_DEPENDENCY_ACL);
}
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
if (oldmembers)
@ -545,7 +545,7 @@ checkSharedDependencies(Oid classId, Oid objectId,
initStringInfo(&descs);
initStringInfo(&alldescs);
sdepRel = heap_open(SharedDependRelationId, AccessShareLock);
sdepRel = table_open(SharedDependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_shdepend_refclassid,
@ -646,7 +646,7 @@ checkSharedDependencies(Oid classId, Oid objectId,
systable_endscan(scan);
heap_close(sdepRel, AccessShareLock);
table_close(sdepRel, AccessShareLock);
/*
* Summarize dependencies in remote databases.
@ -720,7 +720,7 @@ copyTemplateDependencies(Oid templateDbId, Oid newDbId)
bool nulls[Natts_pg_shdepend];
bool replace[Natts_pg_shdepend];
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
sdepDesc = RelationGetDescr(sdepRel);
indstate = CatalogOpenIndexes(sdepRel);
@ -762,7 +762,7 @@ copyTemplateDependencies(Oid templateDbId, Oid newDbId)
systable_endscan(scan);
CatalogCloseIndexes(indstate);
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
/*
@ -779,7 +779,7 @@ dropDatabaseDependencies(Oid databaseId)
SysScanDesc scan;
HeapTuple tup;
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
/*
* First, delete all the entries that have the database Oid in the dbid
@ -806,7 +806,7 @@ dropDatabaseDependencies(Oid databaseId)
InvalidOid, InvalidOid,
SHARED_DEPENDENCY_INVALID);
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
/*
@ -824,14 +824,14 @@ deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, int32 objectSubId)
{
Relation sdepRel;
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
shdepDropDependency(sdepRel, classId, objectId, objectSubId,
(objectSubId == 0),
InvalidOid, InvalidOid,
SHARED_DEPENDENCY_INVALID);
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}
/*
@ -1173,7 +1173,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
* acquire RowExclusiveLock. Better get that right now to avoid potential
* deadlock failures.
*/
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
/*
* For each role, find the dependent objects and drop them using the
@ -1270,7 +1270,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
/* the dependency mechanism does the actual work */
performMultipleDeletions(deleteobjs, behavior, 0);
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
free_object_addresses(deleteobjs);
}
@ -1292,7 +1292,7 @@ shdepReassignOwned(List *roleids, Oid newrole)
* acquire RowExclusiveLock. Better get that right now to avoid potential
* deadlock problems.
*/
sdepRel = heap_open(SharedDependRelationId, RowExclusiveLock);
sdepRel = table_open(SharedDependRelationId, RowExclusiveLock);
foreach(cell, roleids)
{
@ -1428,12 +1428,12 @@ shdepReassignOwned(List *roleids, Oid newrole)
if (classId == LargeObjectRelationId)
classId = LargeObjectMetadataRelationId;
catalog = heap_open(classId, RowExclusiveLock);
catalog = table_open(classId, RowExclusiveLock);
AlterObjectOwner_internal(catalog, sdepForm->objid,
newrole);
heap_close(catalog, NoLock);
table_close(catalog, NoLock);
}
break;
@ -1448,5 +1448,5 @@ shdepReassignOwned(List *roleids, Oid newrole)
systable_endscan(scan);
}
heap_close(sdepRel, RowExclusiveLock);
table_close(sdepRel, RowExclusiveLock);
}

View File

@ -123,7 +123,7 @@ CountDBSubscriptions(Oid dbid)
SysScanDesc scan;
HeapTuple tup;
rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_subscription_subdbid,
@ -138,7 +138,7 @@ CountDBSubscriptions(Oid dbid)
systable_endscan(scan);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return nsubs;
}
@ -247,7 +247,7 @@ AddSubscriptionRelState(Oid subid, Oid relid, char state,
LockSharedObject(SubscriptionRelationId, subid, 0, AccessShareLock);
rel = heap_open(SubscriptionRelRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
/* Try finding existing mapping. */
tup = SearchSysCacheCopy2(SUBSCRIPTIONRELMAP,
@ -276,7 +276,7 @@ AddSubscriptionRelState(Oid subid, Oid relid, char state,
heap_freetuple(tup);
/* Cleanup. */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -294,7 +294,7 @@ UpdateSubscriptionRelState(Oid subid, Oid relid, char state,
LockSharedObject(SubscriptionRelationId, subid, 0, AccessShareLock);
rel = heap_open(SubscriptionRelRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
/* Try finding existing mapping. */
tup = SearchSysCacheCopy2(SUBSCRIPTIONRELMAP,
@ -325,7 +325,7 @@ UpdateSubscriptionRelState(Oid subid, Oid relid, char state,
CatalogTupleUpdate(rel, &tup->t_self, tup);
/* Cleanup. */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -343,7 +343,7 @@ GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn,
bool isnull;
Datum d;
rel = heap_open(SubscriptionRelRelationId, AccessShareLock);
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
/* Try finding the mapping. */
tup = SearchSysCache2(SUBSCRIPTIONRELMAP,
@ -354,7 +354,7 @@ GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn,
{
if (missing_ok)
{
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
*sublsn = InvalidXLogRecPtr;
return SUBREL_STATE_UNKNOWN;
}
@ -377,7 +377,7 @@ GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn,
/* Cleanup */
ReleaseSysCache(tup);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return substate;
}
@ -395,7 +395,7 @@ RemoveSubscriptionRel(Oid subid, Oid relid)
HeapTuple tup;
int nkeys = 0;
rel = heap_open(SubscriptionRelRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelRelationId, RowExclusiveLock);
if (OidIsValid(subid))
{
@ -423,7 +423,7 @@ RemoveSubscriptionRel(Oid subid, Oid relid)
}
heap_endscan(scan);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
@ -442,7 +442,7 @@ GetSubscriptionRelations(Oid subid)
ScanKeyData skey[2];
SysScanDesc scan;
rel = heap_open(SubscriptionRelRelationId, AccessShareLock);
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
ScanKeyInit(&skey[nkeys++],
Anum_pg_subscription_rel_srsubid,
@ -469,7 +469,7 @@ GetSubscriptionRelations(Oid subid)
/* Cleanup */
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return res;
}
@ -489,7 +489,7 @@ GetSubscriptionNotReadyRelations(Oid subid)
ScanKeyData skey[2];
SysScanDesc scan;
rel = heap_open(SubscriptionRelRelationId, AccessShareLock);
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
ScanKeyInit(&skey[nkeys++],
Anum_pg_subscription_rel_srsubid,
@ -521,7 +521,7 @@ GetSubscriptionNotReadyRelations(Oid subid)
/* Cleanup */
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return res;
}

View File

@ -70,7 +70,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
/*
* open pg_type
*/
pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
pg_type_desc = table_open(TypeRelationId, RowExclusiveLock);
tupDesc = pg_type_desc->rd_att;
/*
@ -173,7 +173,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
* clean up and return the type-oid
*/
heap_freetuple(tup);
heap_close(pg_type_desc, RowExclusiveLock);
table_close(pg_type_desc, RowExclusiveLock);
return address;
}
@ -408,7 +408,7 @@ TypeCreate(Oid newTypeOid,
* NOTE: updating will not work correctly in bootstrap mode; but we don't
* expect to be overwriting any shell types in bootstrap mode.
*/
pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
pg_type_desc = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy2(TYPENAMENSP,
CStringGetDatum(typeName),
@ -506,7 +506,7 @@ TypeCreate(Oid newTypeOid,
/*
* finish up
*/
heap_close(pg_type_desc, RowExclusiveLock);
table_close(pg_type_desc, RowExclusiveLock);
return address;
}
@ -714,7 +714,7 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
Oid arrayOid;
Oid oldTypeOid;
pg_type_desc = heap_open(TypeRelationId, RowExclusiveLock);
pg_type_desc = table_open(TypeRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tuple))
@ -757,7 +757,7 @@ RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
InvokeObjectPostAlterHook(TypeRelationId, typeOid, 0);
heap_freetuple(tuple);
heap_close(pg_type_desc, RowExclusiveLock);
table_close(pg_type_desc, RowExclusiveLock);
/*
* If the type has an array type, recurse to handle that. But we don't
@ -792,7 +792,7 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
* The idea is to prepend underscores as needed until we make a name that
* doesn't collide with anything...
*/
pg_type_desc = heap_open(TypeRelationId, AccessShareLock);
pg_type_desc = table_open(TypeRelationId, AccessShareLock);
for (i = 1; i < NAMEDATALEN - 1; i++)
{
@ -810,7 +810,7 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
break;
}
heap_close(pg_type_desc, AccessShareLock);
table_close(pg_type_desc, AccessShareLock);
if (i >= NAMEDATALEN - 1)
ereport(ERROR,

View File

@ -79,12 +79,12 @@ CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool c
{
Relation rel;
rel = heap_open(relOid, lockmode);
rel = table_open(relOid, lockmode);
/* create_toast_table does all the work */
(void) create_toast_table(rel, InvalidOid, InvalidOid, reloptions, lockmode, check);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -97,7 +97,7 @@ BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid)
{
Relation rel;
rel = heap_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
rel = table_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_MATVIEW)
@ -112,7 +112,7 @@ BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid)
elog(ERROR, "\"%s\" does not require a toast table",
relName);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
@ -282,11 +282,11 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
NULL);
Assert(toast_relid != InvalidOid);
/* make the toast relation visible, else heap_open will fail */
/* make the toast relation visible, else table_open will fail */
CommandCounterIncrement();
/* ShareLock is not really needed here, but take it anyway */
toast_rel = heap_open(toast_relid, ShareLock);
toast_rel = table_open(toast_relid, ShareLock);
/*
* Create unique index on chunk_id, chunk_seq.
@ -339,12 +339,12 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
collationObjectId, classObjectId, coloptions, (Datum) 0,
INDEX_CREATE_IS_PRIMARY, 0, true, true, NULL);
heap_close(toast_rel, NoLock);
table_close(toast_rel, NoLock);
/*
* Store the toast table's OID in the parent relation's pg_class row
*/
class_rel = heap_open(RelationRelationId, RowExclusiveLock);
class_rel = table_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(reltup))
@ -365,7 +365,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
heap_freetuple(reltup);
heap_close(class_rel, RowExclusiveLock);
table_close(class_rel, RowExclusiveLock);
/*
* Register dependency from the toast table to the master, so that the

View File

@ -400,11 +400,11 @@ ExecRenameStmt(RenameStmt *stmt)
AccessExclusiveLock, false);
Assert(relation == NULL);
catalog = heap_open(address.classId, RowExclusiveLock);
catalog = table_open(address.classId, RowExclusiveLock);
AlterObjectRename_internal(catalog,
address.objectId,
stmt->newname);
heap_close(catalog, RowExclusiveLock);
table_close(catalog, RowExclusiveLock);
return address;
}
@ -439,7 +439,7 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre
* don't need the relation here, but we'll retain the lock until commit.
*/
if (rel)
heap_close(rel, NoLock);
table_close(rel, NoLock);
refAddr = get_object_address(OBJECT_EXTENSION, (Node *) stmt->extname,
&rel, AccessExclusiveLock, false);
@ -519,12 +519,12 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt,
false);
Assert(relation == NULL);
classId = address.classId;
catalog = heap_open(classId, RowExclusiveLock);
catalog = table_open(classId, RowExclusiveLock);
nspOid = LookupCreationNamespace(stmt->newschema);
oldNspOid = AlterObjectNamespace_internal(catalog, address.objectId,
nspOid);
heap_close(catalog, RowExclusiveLock);
table_close(catalog, RowExclusiveLock);
}
break;
@ -599,12 +599,12 @@ AlterObjectNamespace_oid(Oid classId, Oid objid, Oid nspOid,
{
Relation catalog;
catalog = heap_open(classId, RowExclusiveLock);
catalog = table_open(classId, RowExclusiveLock);
oldNspOid = AlterObjectNamespace_internal(catalog, objid,
nspOid);
heap_close(catalog, RowExclusiveLock);
table_close(catalog, RowExclusiveLock);
}
break;
@ -876,10 +876,10 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
if (classId == LargeObjectRelationId)
classId = LargeObjectMetadataRelationId;
catalog = heap_open(classId, RowExclusiveLock);
catalog = table_open(classId, RowExclusiveLock);
AlterObjectOwner_internal(catalog, address.objectId, newowner);
heap_close(catalog, RowExclusiveLock);
table_close(catalog, RowExclusiveLock);
return address;
}

View File

@ -50,7 +50,7 @@ CreateAccessMethod(CreateAmStmt *stmt)
Datum values[Natts_pg_am];
HeapTuple tup;
rel = heap_open(AccessMethodRelationId, RowExclusiveLock);
rel = table_open(AccessMethodRelationId, RowExclusiveLock);
/* Must be super user */
if (!superuser())
@ -107,7 +107,7 @@ CreateAccessMethod(CreateAmStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return myself;
}
@ -126,7 +126,7 @@ RemoveAccessMethodById(Oid amOid)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to drop access methods")));
relation = heap_open(AccessMethodRelationId, RowExclusiveLock);
relation = table_open(AccessMethodRelationId, RowExclusiveLock);
tup = SearchSysCache1(AMOID, ObjectIdGetDatum(amOid));
if (!HeapTupleIsValid(tup))
@ -136,7 +136,7 @@ RemoveAccessMethodById(Oid amOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/*

View File

@ -1352,14 +1352,14 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
BlockNumber relpages = 0;
/* We already got the needed lock */
childrel = heap_open(childOID, NoLock);
childrel = table_open(childOID, NoLock);
/* Ignore if temp table of another backend */
if (RELATION_IS_OTHER_TEMP(childrel))
{
/* ... but release the lock on it */
Assert(childrel != onerel);
heap_close(childrel, AccessShareLock);
table_close(childrel, AccessShareLock);
continue;
}
@ -1391,7 +1391,7 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
{
/* ignore, but release the lock on it */
Assert(childrel != onerel);
heap_close(childrel, AccessShareLock);
table_close(childrel, AccessShareLock);
continue;
}
}
@ -1403,9 +1403,9 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
*/
Assert(childrel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
if (childrel != onerel)
heap_close(childrel, AccessShareLock);
table_close(childrel, AccessShareLock);
else
heap_close(childrel, NoLock);
table_close(childrel, NoLock);
continue;
}
@ -1501,7 +1501,7 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
* Note: we cannot release the child-table locks, since we may have
* pointers to their TOAST tables in the sampled rows.
*/
heap_close(childrel, NoLock);
table_close(childrel, NoLock);
}
return numrows;
@ -1539,7 +1539,7 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
if (natts <= 0)
return; /* nothing to do */
sd = heap_open(StatisticRelationId, RowExclusiveLock);
sd = table_open(StatisticRelationId, RowExclusiveLock);
for (attno = 0; attno < natts; attno++)
{
@ -1660,7 +1660,7 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
heap_freetuple(stup);
}
heap_close(sd, RowExclusiveLock);
table_close(sd, RowExclusiveLock);
}
/*

View File

@ -118,7 +118,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
AccessExclusiveLock,
0,
RangeVarCallbackOwnsTable, NULL);
rel = heap_open(tableOid, NoLock);
rel = table_open(tableOid, NoLock);
/*
* Reject clustering a remote temp table ... their local buffer
@ -184,7 +184,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
}
/* close relation, keep lock till commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
/* Do the job. */
cluster_rel(tableOid, indexOid, stmt->options);
@ -415,7 +415,7 @@ cluster_rel(Oid tableOid, Oid indexOid, int options)
/* rebuild_relation does all the dirty work */
rebuild_relation(OldHeap, indexOid, verbose);
/* NB: rebuild_relation does heap_close() on OldHeap */
/* NB: rebuild_relation does table_close() on OldHeap */
}
/*
@ -522,7 +522,7 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
/*
* Check each index of the relation and set/clear the bit as needed.
*/
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
pg_index = table_open(IndexRelationId, RowExclusiveLock);
foreach(index, RelationGetIndexList(rel))
{
@ -558,7 +558,7 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
heap_freetuple(indexTuple);
}
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
}
/*
@ -590,7 +590,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid, bool verbose)
is_system_catalog = IsSystemRelation(OldHeap);
/* Close relcache entry, but keep lock until transaction commit */
heap_close(OldHeap, NoLock);
table_close(OldHeap, NoLock);
/* Create the transient table that will receive the re-ordered data */
OIDNewHeap = make_new_heap(tableOid, tableSpace,
@ -636,7 +636,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, char relpersistence,
bool isNull;
Oid namespaceid;
OldHeap = heap_open(OIDOldHeap, lockmode);
OldHeap = table_open(OIDOldHeap, lockmode);
OldHeapDesc = RelationGetDescr(OldHeap);
/*
@ -702,7 +702,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, char relpersistence,
/*
* Advance command counter so that the newly-created relation's catalog
* tuples will be visible to heap_open.
* tuples will be visible to table_open.
*/
CommandCounterIncrement();
@ -734,7 +734,7 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, char relpersistence,
ReleaseSysCache(tuple);
}
heap_close(OldHeap, NoLock);
table_close(OldHeap, NoLock);
return OIDNewHeap;
}
@ -785,8 +785,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool verbose,
/*
* Open the relations we need.
*/
NewHeap = heap_open(OIDNewHeap, AccessExclusiveLock);
OldHeap = heap_open(OIDOldHeap, AccessExclusiveLock);
NewHeap = table_open(OIDNewHeap, AccessExclusiveLock);
OldHeap = table_open(OIDOldHeap, AccessExclusiveLock);
if (OidIsValid(OIDOldIndex))
OldIndex = index_open(OIDOldIndex, AccessExclusiveLock);
else
@ -1120,11 +1120,11 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool verbose,
if (OldIndex != NULL)
index_close(OldIndex, NoLock);
heap_close(OldHeap, NoLock);
heap_close(NewHeap, NoLock);
table_close(OldHeap, NoLock);
table_close(NewHeap, NoLock);
/* Update pg_class to reflect the correct values of pages and tuples. */
relRelation = heap_open(RelationRelationId, RowExclusiveLock);
relRelation = table_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(OIDNewHeap));
if (!HeapTupleIsValid(reltup))
@ -1142,7 +1142,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool verbose,
/* Clean up. */
heap_freetuple(reltup);
heap_close(relRelation, RowExclusiveLock);
table_close(relRelation, RowExclusiveLock);
/* Make the update visible */
CommandCounterIncrement();
@ -1193,7 +1193,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
char swptmpchr;
/* We need writable copies of both pg_class tuples. */
relRelation = heap_open(RelationRelationId, RowExclusiveLock);
relRelation = table_open(RelationRelationId, RowExclusiveLock);
reltup1 = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(r1));
if (!HeapTupleIsValid(reltup1))
@ -1487,7 +1487,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
heap_freetuple(reltup1);
heap_freetuple(reltup2);
heap_close(relRelation, RowExclusiveLock);
table_close(relRelation, RowExclusiveLock);
/*
* Close both relcache entries' smgr links. We need this kluge because
@ -1595,7 +1595,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
HeapTuple reltup;
Form_pg_class relform;
relRelation = heap_open(RelationRelationId, RowExclusiveLock);
relRelation = table_open(RelationRelationId, RowExclusiveLock);
reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(OIDOldHeap));
if (!HeapTupleIsValid(reltup))
@ -1607,7 +1607,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
CatalogTupleUpdate(relRelation, &reltup->t_self, reltup);
heap_close(relRelation, RowExclusiveLock);
table_close(relRelation, RowExclusiveLock);
}
/* Destroy new heap with old filenode */
@ -1646,7 +1646,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
{
Relation newrel;
newrel = heap_open(OIDOldHeap, NoLock);
newrel = table_open(OIDOldHeap, NoLock);
if (OidIsValid(newrel->rd_rel->reltoastrelid))
{
Oid toastidx;
@ -1677,7 +1677,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
{
Relation newrel;
newrel = heap_open(OIDOldHeap, NoLock);
newrel = table_open(OIDOldHeap, NoLock);
RelationClearMissing(newrel);
relation_close(newrel, NoLock);
}
@ -1708,7 +1708,7 @@ get_tables_to_cluster(MemoryContext cluster_context)
* have indisclustered set, because CLUSTER will refuse to set it when
* called with one of them as argument.
*/
indRelation = heap_open(IndexRelationId, AccessShareLock);
indRelation = table_open(IndexRelationId, AccessShareLock);
ScanKeyInit(&entry,
Anum_pg_index_indisclustered,
BTEqualStrategyNumber, F_BOOLEQ,

View File

@ -273,7 +273,7 @@ AlterCollation(AlterCollationStmt *stmt)
char *newversion;
ObjectAddress address;
rel = heap_open(CollationRelationId, RowExclusiveLock);
rel = table_open(CollationRelationId, RowExclusiveLock);
collOid = get_collation_oid(stmt->collname, false);
if (!pg_collation_ownercheck(collOid, GetUserId()))
@ -325,7 +325,7 @@ AlterCollation(AlterCollationStmt *stmt)
ObjectAddressSet(address, CollationRelationId, collOid);
heap_freetuple(tup);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}

View File

@ -185,7 +185,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment)
BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(subid));
description = heap_open(DescriptionRelationId, RowExclusiveLock);
description = table_open(DescriptionRelationId, RowExclusiveLock);
sd = systable_beginscan(description, DescriptionObjIndexId, true,
NULL, 3, skey);
@ -222,7 +222,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment)
/* Done */
heap_close(description, NoLock);
table_close(description, NoLock);
}
/*
@ -275,7 +275,7 @@ CreateSharedComments(Oid oid, Oid classoid, const char *comment)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classoid));
shdescription = heap_open(SharedDescriptionRelationId, RowExclusiveLock);
shdescription = table_open(SharedDescriptionRelationId, RowExclusiveLock);
sd = systable_beginscan(shdescription, SharedDescriptionObjIndexId, true,
NULL, 2, skey);
@ -312,7 +312,7 @@ CreateSharedComments(Oid oid, Oid classoid, const char *comment)
/* Done */
heap_close(shdescription, NoLock);
table_close(shdescription, NoLock);
}
/*
@ -353,7 +353,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
else
nkeys = 2;
description = heap_open(DescriptionRelationId, RowExclusiveLock);
description = table_open(DescriptionRelationId, RowExclusiveLock);
sd = systable_beginscan(description, DescriptionObjIndexId, true,
NULL, nkeys, skey);
@ -364,7 +364,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
/* Done */
systable_endscan(sd);
heap_close(description, RowExclusiveLock);
table_close(description, RowExclusiveLock);
}
/*
@ -389,7 +389,7 @@ DeleteSharedComments(Oid oid, Oid classoid)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classoid));
shdescription = heap_open(SharedDescriptionRelationId, RowExclusiveLock);
shdescription = table_open(SharedDescriptionRelationId, RowExclusiveLock);
sd = systable_beginscan(shdescription, SharedDescriptionObjIndexId, true,
NULL, 2, skey);
@ -400,7 +400,7 @@ DeleteSharedComments(Oid oid, Oid classoid)
/* Done */
systable_endscan(sd);
heap_close(shdescription, RowExclusiveLock);
table_close(shdescription, RowExclusiveLock);
}
/*
@ -431,7 +431,7 @@ GetComment(Oid oid, Oid classoid, int32 subid)
BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(subid));
description = heap_open(DescriptionRelationId, AccessShareLock);
description = table_open(DescriptionRelationId, AccessShareLock);
tupdesc = RelationGetDescr(description);
sd = systable_beginscan(description, DescriptionObjIndexId, true,
@ -453,7 +453,7 @@ GetComment(Oid oid, Oid classoid, int32 subid)
systable_endscan(sd);
/* Done */
heap_close(description, AccessShareLock);
table_close(description, AccessShareLock);
return comment;
}

View File

@ -852,7 +852,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
Assert(!stmt->query);
/* Open and lock the relation, using the appropriate lock type. */
rel = heap_openrv(stmt->relation, lockmode);
rel = table_openrv(stmt->relation, lockmode);
relid = RelationGetRelid(rel);
@ -1000,7 +1000,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
*
* We'll reopen it later as part of the query-based COPY.
*/
heap_close(rel, NoLock);
table_close(rel, NoLock);
rel = NULL;
}
}
@ -1047,7 +1047,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
* ensure that updates will be committed before lock is released.
*/
if (rel != NULL)
heap_close(rel, (is_from ? NoLock : AccessShareLock));
table_close(rel, (is_from ? NoLock : AccessShareLock));
}
/*

View File

@ -504,7 +504,7 @@ intorel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
/*
* Finally we can open the target table
*/
intoRelationDesc = heap_open(intoRelationAddr.objectId, AccessExclusiveLock);
intoRelationDesc = table_open(intoRelationAddr.objectId, AccessExclusiveLock);
/*
* Check INSERT permission on the constructed table.
@ -605,7 +605,7 @@ intorel_shutdown(DestReceiver *self)
heap_sync(myState->rel);
/* close rel, but keep lock until commit */
heap_close(myState->rel, NoLock);
table_close(myState->rel, NoLock);
myState->rel = NULL;
}

View File

@ -500,7 +500,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
* filename conflict with anything already existing in the tablespace
* directories.
*/
pg_database_rel = heap_open(DatabaseRelationId, RowExclusiveLock);
pg_database_rel = table_open(DatabaseRelationId, RowExclusiveLock);
do
{
@ -589,7 +589,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
* Iterate through all tablespaces of the template database, and copy
* each one to the new database.
*/
rel = heap_open(TableSpaceRelationId, AccessShareLock);
rel = table_open(TableSpaceRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@ -645,7 +645,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
}
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
/*
* We force a checkpoint before committing. This effectively means
@ -681,7 +681,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
/*
* Close pg_database, but keep lock till commit.
*/
heap_close(pg_database_rel, NoLock);
table_close(pg_database_rel, NoLock);
/*
* Force synchronous commit, thus minimizing the window between
@ -797,7 +797,7 @@ dropdb(const char *dbname, bool missing_ok)
* using it as a CREATE DATABASE template or trying to delete it for
* themselves.
*/
pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock);
pgdbrel = table_open(DatabaseRelationId, RowExclusiveLock);
if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL,
&db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
@ -811,7 +811,7 @@ dropdb(const char *dbname, bool missing_ok)
else
{
/* Close pg_database, release the lock, since we changed nothing */
heap_close(pgdbrel, RowExclusiveLock);
table_close(pgdbrel, RowExclusiveLock);
ereport(NOTICE,
(errmsg("database \"%s\" does not exist, skipping",
dbname)));
@ -959,7 +959,7 @@ dropdb(const char *dbname, bool missing_ok)
/*
* Close pg_database, but keep lock till commit.
*/
heap_close(pgdbrel, NoLock);
table_close(pgdbrel, NoLock);
/*
* Force synchronous commit, thus minimizing the window between removal of
@ -988,7 +988,7 @@ RenameDatabase(const char *oldname, const char *newname)
* Look up the target database's OID, and get exclusive lock on it. We
* need this for the same reasons as DROP DATABASE.
*/
rel = heap_open(DatabaseRelationId, RowExclusiveLock);
rel = table_open(DatabaseRelationId, RowExclusiveLock);
if (!get_db_info(oldname, AccessExclusiveLock, &db_id, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
@ -1054,7 +1054,7 @@ RenameDatabase(const char *oldname, const char *newname)
/*
* Close pg_database, but keep lock till commit.
*/
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
@ -1092,7 +1092,7 @@ movedb(const char *dbname, const char *tblspcname)
* we are moving it, and that no one is using it as a CREATE DATABASE
* template or trying to delete it.
*/
pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock);
pgdbrel = table_open(DatabaseRelationId, RowExclusiveLock);
if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL))
@ -1151,7 +1151,7 @@ movedb(const char *dbname, const char *tblspcname)
*/
if (src_tblspcoid == dst_tblspcoid)
{
heap_close(pgdbrel, NoLock);
table_close(pgdbrel, NoLock);
UnlockSharedObjectForSession(DatabaseRelationId, db_id, 0,
AccessExclusiveLock);
return;
@ -1325,7 +1325,7 @@ movedb(const char *dbname, const char *tblspcname)
/*
* Close pg_database, but keep lock till commit.
*/
heap_close(pgdbrel, NoLock);
table_close(pgdbrel, NoLock);
}
PG_END_ENSURE_ERROR_CLEANUP(movedb_failure_callback,
PointerGetDatum(&fparms));
@ -1500,7 +1500,7 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel)
* because we're not going to do anything that would mess up incoming
* connections.
*/
rel = heap_open(DatabaseRelationId, RowExclusiveLock);
rel = table_open(DatabaseRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ,
@ -1563,7 +1563,7 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel)
systable_endscan(scan);
/* Close pg_database, but keep lock till commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
return dboid;
}
@ -1614,7 +1614,7 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
* because we're not going to do anything that would mess up incoming
* connections.
*/
rel = heap_open(DatabaseRelationId, RowExclusiveLock);
rel = table_open(DatabaseRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ,
@ -1705,7 +1705,7 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
systable_endscan(scan);
/* Close pg_database, but keep lock till commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
@ -1735,7 +1735,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
AssertArg(name);
/* Caller may wish to grab a better lock on pg_database beforehand... */
relation = heap_open(DatabaseRelationId, AccessShareLock);
relation = table_open(DatabaseRelationId, AccessShareLock);
/*
* Loop covers the rare case where the database is renamed before we can
@ -1836,7 +1836,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
UnlockSharedObject(DatabaseRelationId, dbOid, 0, lockmode);
}
heap_close(relation, AccessShareLock);
table_close(relation, AccessShareLock);
return result;
}
@ -1874,7 +1874,7 @@ remove_dbtablespaces(Oid db_id)
HeapScanDesc scan;
HeapTuple tuple;
rel = heap_open(TableSpaceRelationId, AccessShareLock);
rel = table_open(TableSpaceRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@ -1919,7 +1919,7 @@ remove_dbtablespaces(Oid db_id)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
}
/*
@ -1942,7 +1942,7 @@ check_db_file_conflict(Oid db_id)
HeapScanDesc scan;
HeapTuple tuple;
rel = heap_open(TableSpaceRelationId, AccessShareLock);
rel = table_open(TableSpaceRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@ -1969,7 +1969,7 @@ check_db_file_conflict(Oid db_id)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return result;
}
@ -2020,7 +2020,7 @@ get_database_oid(const char *dbname, bool missing_ok)
* There's no syscache for pg_database indexed by name, so we must look
* the hard way.
*/
pg_database = heap_open(DatabaseRelationId, AccessShareLock);
pg_database = table_open(DatabaseRelationId, AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_database_datname,
BTEqualStrategyNumber, F_NAMEEQ,
@ -2037,7 +2037,7 @@ get_database_oid(const char *dbname, bool missing_ok)
oid = InvalidOid;
systable_endscan(scan);
heap_close(pg_database, AccessShareLock);
table_close(pg_database, AccessShareLock);
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,

View File

@ -117,7 +117,7 @@ RemoveObjects(DropStmt *stmt)
/* Release any relcache reference count, but keep lock until commit. */
if (relation)
heap_close(relation, NoLock);
table_close(relation, NoLock);
add_exact_object_address(&address, objects);
}

View File

@ -390,7 +390,7 @@ insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtO
referenced;
/* Open pg_event_trigger. */
tgrel = heap_open(EventTriggerRelationId, RowExclusiveLock);
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
/* Build the new pg_trigger tuple. */
trigoid = GetNewOidWithIndex(tgrel, EventTriggerOidIndexId,
@ -435,7 +435,7 @@ insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtO
InvokeObjectPostCreateHook(EventTriggerRelationId, trigoid, 0);
/* Close pg_event_trigger. */
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
return trigoid;
}
@ -486,7 +486,7 @@ RemoveEventTriggerById(Oid trigOid)
Relation tgrel;
HeapTuple tup;
tgrel = heap_open(EventTriggerRelationId, RowExclusiveLock);
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
tup = SearchSysCache1(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
if (!HeapTupleIsValid(tup))
@ -496,7 +496,7 @@ RemoveEventTriggerById(Oid trigOid)
ReleaseSysCache(tup);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
}
/*
@ -511,7 +511,7 @@ AlterEventTrigger(AlterEventTrigStmt *stmt)
Form_pg_event_trigger evtForm;
char tgenabled = stmt->tgenabled;
tgrel = heap_open(EventTriggerRelationId, RowExclusiveLock);
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(EVENTTRIGGERNAME,
CStringGetDatum(stmt->trigname));
@ -538,7 +538,7 @@ AlterEventTrigger(AlterEventTrigStmt *stmt)
/* clean up */
heap_freetuple(tup);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
return trigoid;
}
@ -555,7 +555,7 @@ AlterEventTriggerOwner(const char *name, Oid newOwnerId)
Relation rel;
ObjectAddress address;
rel = heap_open(EventTriggerRelationId, RowExclusiveLock);
rel = table_open(EventTriggerRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(EVENTTRIGGERNAME, CStringGetDatum(name));
@ -573,7 +573,7 @@ AlterEventTriggerOwner(const char *name, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -587,7 +587,7 @@ AlterEventTriggerOwner_oid(Oid trigOid, Oid newOwnerId)
HeapTuple tup;
Relation rel;
rel = heap_open(EventTriggerRelationId, RowExclusiveLock);
rel = table_open(EventTriggerRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
@ -600,7 +600,7 @@ AlterEventTriggerOwner_oid(Oid trigOid, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -1364,7 +1364,7 @@ EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool no
Relation catalog;
HeapTuple tuple;
catalog = heap_open(obj->address.classId, AccessShareLock);
catalog = table_open(obj->address.classId, AccessShareLock);
tuple = get_catalog_object_by_oid(catalog,
get_object_attnum_oid(object->classId),
obj->address.objectId);
@ -1394,7 +1394,7 @@ EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool no
else if (isAnyTempNamespace(namespaceId))
{
pfree(obj);
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
MemoryContextSwitchTo(oldcxt);
return;
}
@ -1420,7 +1420,7 @@ EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool no
}
}
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
}
else
{
@ -2114,7 +2114,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
Oid schema_oid;
bool isnull;
catalog = heap_open(addr.classId, AccessShareLock);
catalog = table_open(addr.classId, AccessShareLock);
objtup = get_catalog_object_by_oid(catalog,
get_object_attnum_oid(addr.classId),
addr.objectId);
@ -2134,7 +2134,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
else
schema = get_namespace_name(schema_oid);
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
}
}

View File

@ -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

View File

@ -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);
}
/*

View File

@ -1135,7 +1135,7 @@ RemoveFunctionById(Oid funcOid)
/*
* Delete the pg_proc tuple.
*/
relation = heap_open(ProcedureRelationId, RowExclusiveLock);
relation = table_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1147,14 +1147,14 @@ RemoveFunctionById(Oid funcOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
/*
* If there's a pg_aggregate tuple, delete that too.
*/
if (prokind == PROKIND_AGGREGATE)
{
relation = heap_open(AggregateRelationId, RowExclusiveLock);
relation = table_open(AggregateRelationId, RowExclusiveLock);
tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1164,7 +1164,7 @@ RemoveFunctionById(Oid funcOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
}
@ -1192,7 +1192,7 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
DefElem *parallel_item = NULL;
ObjectAddress address;
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
rel = table_open(ProcedureRelationId, RowExclusiveLock);
funcOid = LookupFuncWithArgs(stmt->objtype, stmt->func, false);
@ -1312,7 +1312,7 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
ObjectAddressSet(address, ProcedureRelationId, funcOid);
heap_close(rel, NoLock);
table_close(rel, NoLock);
heap_freetuple(tup);
return address;
@ -1334,7 +1334,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType)
ObjectAddress func_address;
ObjectAddress type_address;
pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
pg_proc_rel = table_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1350,7 +1350,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType)
/* update the catalog and its indexes */
CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup);
heap_close(pg_proc_rel, RowExclusiveLock);
table_close(pg_proc_rel, RowExclusiveLock);
/*
* Also update the dependency to the new type. Opaque is a pinned type, so
@ -1376,7 +1376,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
ObjectAddress func_address;
ObjectAddress type_address;
pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
pg_proc_rel = table_open(ProcedureRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1393,7 +1393,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
/* update the catalog and its indexes */
CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup);
heap_close(pg_proc_rel, RowExclusiveLock);
table_close(pg_proc_rel, RowExclusiveLock);
/*
* Also update the dependency to the new type. Opaque is a pinned type, so
@ -1651,7 +1651,7 @@ CreateCast(CreateCastStmt *stmt)
break;
}
relation = heap_open(CastRelationId, RowExclusiveLock);
relation = table_open(CastRelationId, RowExclusiveLock);
/*
* Check for duplicate. This is just to give a friendly error message,
@ -1717,7 +1717,7 @@ CreateCast(CreateCastStmt *stmt)
heap_freetuple(tuple);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
return myself;
}
@ -1753,7 +1753,7 @@ DropCastById(Oid castOid)
SysScanDesc scan;
HeapTuple tuple;
relation = heap_open(CastRelationId, RowExclusiveLock);
relation = table_open(CastRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_cast_oid,
@ -1768,7 +1768,7 @@ DropCastById(Oid castOid)
CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
@ -1921,7 +1921,7 @@ CreateTransform(CreateTransformStmt *stmt)
MemSet(nulls, false, sizeof(nulls));
relation = heap_open(TransformRelationId, RowExclusiveLock);
relation = table_open(TransformRelationId, RowExclusiveLock);
tuple = SearchSysCache2(TRFTYPELANG,
ObjectIdGetDatum(typeid),
@ -2002,7 +2002,7 @@ CreateTransform(CreateTransformStmt *stmt)
heap_freetuple(newtuple);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
return myself;
}
@ -2040,7 +2040,7 @@ DropTransformById(Oid transformOid)
SysScanDesc scan;
HeapTuple tuple;
relation = heap_open(TransformRelationId, RowExclusiveLock);
relation = table_open(TransformRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
Anum_pg_transform_oid,
@ -2055,7 +2055,7 @@ DropTransformById(Oid transformOid)
CatalogTupleDelete(relation, &tuple->t_self);
systable_endscan(scan);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}

View File

@ -414,7 +414,7 @@ DefineIndex(Oid relationId,
* functions will need to be updated, too.
*/
lockmode = stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock;
rel = heap_open(relationId, lockmode);
rel = table_open(relationId, lockmode);
namespaceId = RelationGetNamespace(rel);
@ -866,7 +866,7 @@ DefineIndex(Oid relationId,
if (!OidIsValid(indexRelationId))
{
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
@ -899,7 +899,7 @@ DefineIndex(Oid relationId,
for (i = 0; i < numberOfKeyAttributes; i++)
opfamOids[i] = get_opclass_family(classObjectId[i]);
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* For each partition, scan all existing indexes; if one matches
@ -919,7 +919,7 @@ DefineIndex(Oid relationId,
bool found = false;
int maplen;
childrel = heap_open(childRelid, lockmode);
childrel = table_open(childRelid, lockmode);
childidxs = RelationGetIndexList(childrel);
attmap =
convert_tuples_by_name_map(RelationGetDescr(childrel),
@ -989,7 +989,7 @@ DefineIndex(Oid relationId,
}
list_free(childidxs);
heap_close(childrel, NoLock);
table_close(childrel, NoLock);
/*
* If no matching index was found, create our own.
@ -1051,7 +1051,7 @@ DefineIndex(Oid relationId,
*/
if (invalidate_parent)
{
Relation pg_index = heap_open(IndexRelationId, RowExclusiveLock);
Relation pg_index = table_open(IndexRelationId, RowExclusiveLock);
HeapTuple tup,
newtup;
@ -1064,12 +1064,12 @@ DefineIndex(Oid relationId,
((Form_pg_index) GETSTRUCT(newtup))->indisvalid = false;
CatalogTupleUpdate(pg_index, &tup->t_self, newtup);
ReleaseSysCache(tup);
heap_close(pg_index, RowExclusiveLock);
table_close(pg_index, RowExclusiveLock);
heap_freetuple(newtup);
}
}
else
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* Indexes on partitioned tables are not themselves built, so we're
@ -1081,14 +1081,14 @@ DefineIndex(Oid relationId,
if (!stmt->concurrent)
{
/* Close the heap and we're done, in the non-concurrent case */
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
/* save lockrelid and locktag for below, then close rel */
heaprelid = rel->rd_lockInfo.lockRelId;
SET_LOCKTAG_RELATION(heaplocktag, heaprelid.dbId, heaprelid.relId);
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* For a concurrent build, it's important to make the catalog entries
@ -1154,7 +1154,7 @@ DefineIndex(Oid relationId,
*/
/* Open and lock the parent heap relation */
rel = heap_open(relationId, ShareUpdateExclusiveLock);
rel = table_open(relationId, ShareUpdateExclusiveLock);
/* And the target index relation */
indexRelation = index_open(indexRelationId, RowExclusiveLock);
@ -1172,7 +1172,7 @@ DefineIndex(Oid relationId,
index_build(rel, indexRelation, indexInfo, stmt->primary, false, true);
/* Close both the relations, but keep the locks */
heap_close(rel, NoLock);
table_close(rel, NoLock);
index_close(indexRelation, NoLock);
/*
@ -1857,7 +1857,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
* we need a tiebreaker.) If we find more than one exact match, then
* someone put bogus entries in pg_opclass.
*/
rel = heap_open(OperatorClassRelationId, AccessShareLock);
rel = table_open(OperatorClassRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_opclass_opcmethod,
@ -1897,7 +1897,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
/* raise error if pg_opclass contains inconsistent data */
if (nexact > 1)
@ -2411,7 +2411,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
* We only consider plain relations and materialized views here (toast
* rels will be processed indirectly by reindex_relation).
*/
relationRelation = heap_open(RelationRelationId, AccessShareLock);
relationRelation = table_open(RelationRelationId, AccessShareLock);
scan = heap_beginscan_catalog(relationRelation, num_keys, scan_keys);
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
@ -2472,7 +2472,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
MemoryContextSwitchTo(old);
}
heap_endscan(scan);
heap_close(relationRelation, AccessShareLock);
table_close(relationRelation, AccessShareLock);
/* Now reindex each rel in a separate transaction */
PopActiveSnapshot();

View File

@ -273,7 +273,7 @@ LockViewRecurse(Oid reloid, LOCKMODE lockmode, bool nowait, List *ancestor_views
Relation view;
Query *viewquery;
view = heap_open(reloid, NoLock);
view = table_open(reloid, NoLock);
viewquery = get_view_query(view);
context.lockmode = lockmode;
@ -286,7 +286,7 @@ LockViewRecurse(Oid reloid, LOCKMODE lockmode, bool nowait, List *ancestor_views
ancestor_views = list_delete_oid(ancestor_views, reloid);
heap_close(view, NoLock);
table_close(view, NoLock);
}
/*

View File

@ -92,7 +92,7 @@ SetMatViewPopulatedState(Relation relation, bool newstate)
* (and this one too!) are sent SI message to make them rebuild relcache
* entries.
*/
pgrel = heap_open(RelationRelationId, RowExclusiveLock);
pgrel = table_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(relation)));
if (!HeapTupleIsValid(tuple))
@ -104,7 +104,7 @@ SetMatViewPopulatedState(Relation relation, bool newstate)
CatalogTupleUpdate(pgrel, &tuple->t_self, tuple);
heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
table_close(pgrel, RowExclusiveLock);
/*
* Advance command counter to make the updated pg_class row locally
@ -165,7 +165,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
matviewOid = RangeVarGetRelidExtended(stmt->relation,
lockmode, 0,
RangeVarCallbackOwnsTable, NULL);
matviewRel = heap_open(matviewOid, NoLock);
matviewRel = table_open(matviewOid, NoLock);
/* Make sure it is a materialized view. */
if (matviewRel->rd_rel->relkind != RELKIND_MATVIEW)
@ -345,7 +345,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
pgstat_count_heap_insert(matviewRel, processed);
}
heap_close(matviewRel, NoLock);
table_close(matviewRel, NoLock);
/* Roll back any GUC changes */
AtEOXact_GUC(false, save_nestlevel);
@ -449,7 +449,7 @@ transientrel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
DR_transientrel *myState = (DR_transientrel *) self;
Relation transientrel;
transientrel = heap_open(myState->transientoid, NoLock);
transientrel = table_open(myState->transientoid, NoLock);
/*
* Fill private fields of myState for use by later routines
@ -514,7 +514,7 @@ transientrel_shutdown(DestReceiver *self)
heap_sync(myState->transientrel);
/* close transientrel, but keep lock until commit */
heap_close(myState->transientrel, NoLock);
table_close(myState->transientrel, NoLock);
myState->transientrel = NULL;
}
@ -596,10 +596,10 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
Oid *opUsedForQual;
initStringInfo(&querybuf);
matviewRel = heap_open(matviewOid, NoLock);
matviewRel = table_open(matviewOid, NoLock);
matviewname = quote_qualified_identifier(get_namespace_name(RelationGetNamespace(matviewRel)),
RelationGetRelationName(matviewRel));
tempRel = heap_open(tempOid, NoLock);
tempRel = table_open(tempOid, NoLock);
tempname = quote_qualified_identifier(get_namespace_name(RelationGetNamespace(tempRel)),
RelationGetRelationName(tempRel));
diffname = make_temptable_name_n(tempname, 2);
@ -827,8 +827,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
/* We're done maintaining the materialized view. */
CloseMatViewIncrementalMaintenance();
heap_close(tempRel, NoLock);
heap_close(matviewRel, NoLock);
table_close(tempRel, NoLock);
table_close(matviewRel, NoLock);
/* Clean up temp tables. */
resetStringInfo(&querybuf);

View File

@ -255,7 +255,7 @@ CreateOpFamily(const char *amname, const char *opfname, Oid namespaceoid, Oid am
ObjectAddress myself,
referenced;
rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
rel = table_open(OperatorFamilyRelationId, RowExclusiveLock);
/*
* Make sure there is no existing opfamily of this name (this is just to
@ -319,7 +319,7 @@ CreateOpFamily(const char *amname, const char *opfname, Oid namespaceoid, Oid am
/* Post creation hook for new operator family */
InvokeObjectPostCreateHook(OperatorFamilyRelationId, opfamilyoid, 0);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return myself;
}
@ -587,7 +587,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
stmt->amname)));
}
rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
rel = table_open(OperatorClassRelationId, RowExclusiveLock);
/*
* Make sure there is no existing opclass of this name (this is just to
@ -718,7 +718,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
/* Post creation hook for new operator class */
InvokeObjectPostCreateHook(OperatorClassRelationId, opclassoid, 0);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return myself;
}
@ -1317,7 +1317,7 @@ storeOperators(List *opfamilyname, Oid amoid,
referenced;
ListCell *l;
rel = heap_open(AccessMethodOperatorRelationId, RowExclusiveLock);
rel = table_open(AccessMethodOperatorRelationId, RowExclusiveLock);
foreach(l, operators)
{
@ -1411,7 +1411,7 @@ storeOperators(List *opfamilyname, Oid amoid,
entryoid, 0);
}
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -1435,7 +1435,7 @@ storeProcedures(List *opfamilyname, Oid amoid,
referenced;
ListCell *l;
rel = heap_open(AccessMethodProcedureRelationId, RowExclusiveLock);
rel = table_open(AccessMethodProcedureRelationId, RowExclusiveLock);
foreach(l, procedures)
{
@ -1514,7 +1514,7 @@ storeProcedures(List *opfamilyname, Oid amoid,
entryoid, 0);
}
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
@ -1607,7 +1607,7 @@ RemoveOpFamilyById(Oid opfamilyOid)
Relation rel;
HeapTuple tup;
rel = heap_open(OperatorFamilyRelationId, RowExclusiveLock);
rel = table_open(OperatorFamilyRelationId, RowExclusiveLock);
tup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1617,7 +1617,7 @@ RemoveOpFamilyById(Oid opfamilyOid)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
void
@ -1626,7 +1626,7 @@ RemoveOpClassById(Oid opclassOid)
Relation rel;
HeapTuple tup;
rel = heap_open(OperatorClassRelationId, RowExclusiveLock);
rel = table_open(OperatorClassRelationId, RowExclusiveLock);
tup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -1636,7 +1636,7 @@ RemoveOpClassById(Oid opclassOid)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
void
@ -1652,7 +1652,7 @@ RemoveAmOpEntryById(Oid entryOid)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(entryOid));
rel = heap_open(AccessMethodOperatorRelationId, RowExclusiveLock);
rel = table_open(AccessMethodOperatorRelationId, RowExclusiveLock);
scan = systable_beginscan(rel, AccessMethodOperatorOidIndexId, true,
NULL, 1, skey);
@ -1665,7 +1665,7 @@ RemoveAmOpEntryById(Oid entryOid)
CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
void
@ -1681,7 +1681,7 @@ RemoveAmProcEntryById(Oid entryOid)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(entryOid));
rel = heap_open(AccessMethodProcedureRelationId, RowExclusiveLock);
rel = table_open(AccessMethodProcedureRelationId, RowExclusiveLock);
scan = systable_beginscan(rel, AccessMethodProcedureOidIndexId, true,
NULL, 1, skey);
@ -1694,7 +1694,7 @@ RemoveAmProcEntryById(Oid entryOid)
CatalogTupleDelete(rel, &tup->t_self);
systable_endscan(scan);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*

View File

@ -345,7 +345,7 @@ RemoveOperatorById(Oid operOid)
HeapTuple tup;
Form_pg_operator op;
relation = heap_open(OperatorRelationId, RowExclusiveLock);
relation = table_open(OperatorRelationId, RowExclusiveLock);
tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
@ -374,7 +374,7 @@ RemoveOperatorById(Oid operOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/*
@ -405,7 +405,7 @@ AlterOperator(AlterOperatorStmt *stmt)
/* Look up the operator */
oprId = LookupOperWithArgs(stmt->opername, false);
catalog = heap_open(OperatorRelationId, RowExclusiveLock);
catalog = table_open(OperatorRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(OPEROID, ObjectIdGetDatum(oprId));
if (tup == NULL)
elog(ERROR, "cache lookup failed for operator %u", oprId);
@ -524,7 +524,7 @@ AlterOperator(AlterOperatorStmt *stmt)
InvokeObjectPostAlterHook(OperatorRelationId, oprId, 0);
heap_close(catalog, NoLock);
table_close(catalog, NoLock);
return address;
}

View File

@ -221,7 +221,7 @@ RelationBuildRowSecurity(Relation relation)
rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc));
rsdesc->rscxt = rscxt;
catalog = heap_open(PolicyRelationId, AccessShareLock);
catalog = table_open(PolicyRelationId, AccessShareLock);
ScanKeyInit(&skey,
Anum_pg_policy_polrelid,
@ -328,7 +328,7 @@ RelationBuildRowSecurity(Relation relation)
}
systable_endscan(sscan);
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
}
PG_CATCH();
{
@ -360,7 +360,7 @@ RemovePolicyById(Oid policy_id)
Oid relid;
Relation rel;
pg_policy_rel = heap_open(PolicyRelationId, RowExclusiveLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
/*
* Find the policy to delete.
@ -387,7 +387,7 @@ RemovePolicyById(Oid policy_id)
*/
relid = ((Form_pg_policy) GETSTRUCT(tuple))->polrelid;
rel = heap_open(relid, AccessExclusiveLock);
rel = table_open(relid, AccessExclusiveLock);
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
ereport(ERROR,
@ -415,10 +415,10 @@ RemovePolicyById(Oid policy_id)
*/
CacheInvalidateRelcache(rel);
heap_close(rel, NoLock);
table_close(rel, NoLock);
/* Clean up */
heap_close(pg_policy_rel, RowExclusiveLock);
table_close(pg_policy_rel, RowExclusiveLock);
}
/*
@ -452,7 +452,7 @@ RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id)
Assert(classid == PolicyRelationId);
pg_policy_rel = heap_open(PolicyRelationId, RowExclusiveLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
/*
* Find the policy to update.
@ -675,7 +675,7 @@ RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id)
relation_close(rel, NoLock);
heap_close(pg_policy_rel, RowExclusiveLock);
table_close(pg_policy_rel, RowExclusiveLock);
return (noperm || num_roles > 0);
}
@ -781,7 +781,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
assign_expr_collations(with_check_pstate, with_check_qual);
/* Open pg_policy catalog */
pg_policy_rel = heap_open(PolicyRelationId, RowExclusiveLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
/* Set key - policy's relation id. */
ScanKeyInit(&skey[0],
@ -875,7 +875,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
free_parsestate(with_check_pstate);
systable_endscan(sscan);
relation_close(target_table, NoLock);
heap_close(pg_policy_rel, RowExclusiveLock);
table_close(pg_policy_rel, RowExclusiveLock);
return myself;
}
@ -983,7 +983,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
memset(isnull, 0, sizeof(isnull));
/* Find policy to update. */
pg_policy_rel = heap_open(PolicyRelationId, RowExclusiveLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
/* Set key - policy's relation id. */
ScanKeyInit(&skey[0],
@ -1205,7 +1205,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
/* Clean up. */
systable_endscan(sscan);
relation_close(target_table, NoLock);
heap_close(pg_policy_rel, RowExclusiveLock);
table_close(pg_policy_rel, RowExclusiveLock);
return myself;
}
@ -1234,7 +1234,7 @@ rename_policy(RenameStmt *stmt)
target_table = relation_open(table_id, NoLock);
pg_policy_rel = heap_open(PolicyRelationId, RowExclusiveLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
/* First pass -- check for conflict */
@ -1310,7 +1310,7 @@ rename_policy(RenameStmt *stmt)
/* Clean up. */
systable_endscan(sscan);
heap_close(pg_policy_rel, RowExclusiveLock);
table_close(pg_policy_rel, RowExclusiveLock);
relation_close(target_table, NoLock);
return address;
@ -1331,7 +1331,7 @@ get_relation_policy_oid(Oid relid, const char *policy_name, bool missing_ok)
HeapTuple policy_tuple;
Oid policy_oid;
pg_policy_rel = heap_open(PolicyRelationId, AccessShareLock);
pg_policy_rel = table_open(PolicyRelationId, AccessShareLock);
/* Add key - policy's relation id. */
ScanKeyInit(&skey[0],
@ -1366,7 +1366,7 @@ get_relation_policy_oid(Oid relid, const char *policy_name, bool missing_ok)
/* Clean up. */
systable_endscan(sscan);
heap_close(pg_policy_rel, AccessShareLock);
table_close(pg_policy_rel, AccessShareLock);
return policy_oid;
}
@ -1383,7 +1383,7 @@ relation_has_policies(Relation rel)
HeapTuple policy_tuple;
bool ret = false;
catalog = heap_open(PolicyRelationId, AccessShareLock);
catalog = table_open(PolicyRelationId, AccessShareLock);
ScanKeyInit(&skey,
Anum_pg_policy_polrelid,
BTEqualStrategyNumber, F_OIDEQ,
@ -1395,7 +1395,7 @@ relation_has_policies(Relation rel)
ret = true;
systable_endscan(sscan);
heap_close(catalog, AccessShareLock);
table_close(catalog, AccessShareLock);
return ret;
}

View File

@ -335,7 +335,7 @@ create_proc_lang(const char *languageName, bool replace,
ObjectAddress myself,
referenced;
rel = heap_open(LanguageRelationId, RowExclusiveLock);
rel = table_open(LanguageRelationId, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
/* Prepare data to be inserted */
@ -444,7 +444,7 @@ create_proc_lang(const char *languageName, bool replace,
/* Post creation hook for new procedural language */
InvokeObjectPostCreateHook(LanguageRelationId, myself.objectId, 0);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return myself;
}
@ -461,7 +461,7 @@ find_language_template(const char *languageName)
ScanKeyData key;
HeapTuple tup;
rel = heap_open(PLTemplateRelationId, AccessShareLock);
rel = table_open(PLTemplateRelationId, AccessShareLock);
ScanKeyInit(&key,
Anum_pg_pltemplate_tmplname,
@ -511,7 +511,7 @@ find_language_template(const char *languageName)
systable_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return result;
}
@ -535,7 +535,7 @@ DropProceduralLanguageById(Oid langOid)
Relation rel;
HeapTuple langTup;
rel = heap_open(LanguageRelationId, RowExclusiveLock);
rel = table_open(LanguageRelationId, RowExclusiveLock);
langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(langOid));
if (!HeapTupleIsValid(langTup)) /* should not happen */
@ -545,7 +545,7 @@ DropProceduralLanguageById(Oid langOid)
ReleaseSysCache(langTup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*

View File

@ -165,7 +165,7 @@ CreatePublication(CreatePublicationStmt *stmt)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to create FOR ALL TABLES publication"))));
rel = heap_open(PublicationRelationId, RowExclusiveLock);
rel = table_open(PublicationRelationId, RowExclusiveLock);
/* Check if name is used */
puboid = GetSysCacheOid1(PUBLICATIONNAME, Anum_pg_publication_oid,
@ -229,7 +229,7 @@ CreatePublication(CreatePublicationStmt *stmt)
CloseTableList(rels);
}
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
InvokeObjectPostCreateHook(PublicationRelationId, puboid, 0);
@ -377,8 +377,8 @@ AlterPublicationTables(AlterPublicationStmt *stmt, Relation rel,
if (!found)
{
Relation oldrel = heap_open(oldrelid,
ShareUpdateExclusiveLock);
Relation oldrel = table_open(oldrelid,
ShareUpdateExclusiveLock);
delrels = lappend(delrels, oldrel);
}
@ -412,7 +412,7 @@ AlterPublication(AlterPublicationStmt *stmt)
HeapTuple tup;
Form_pg_publication pubform;
rel = heap_open(PublicationRelationId, RowExclusiveLock);
rel = table_open(PublicationRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PUBLICATIONNAME,
CStringGetDatum(stmt->pubname));
@ -437,7 +437,7 @@ AlterPublication(AlterPublicationStmt *stmt)
/* Cleanup. */
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -449,7 +449,7 @@ RemovePublicationById(Oid pubid)
Relation rel;
HeapTuple tup;
rel = heap_open(PublicationRelationId, RowExclusiveLock);
rel = table_open(PublicationRelationId, RowExclusiveLock);
tup = SearchSysCache1(PUBLICATIONOID, ObjectIdGetDatum(pubid));
@ -460,7 +460,7 @@ RemovePublicationById(Oid pubid)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -473,7 +473,7 @@ RemovePublicationRelById(Oid proid)
HeapTuple tup;
Form_pg_publication_rel pubrel;
rel = heap_open(PublicationRelRelationId, RowExclusiveLock);
rel = table_open(PublicationRelRelationId, RowExclusiveLock);
tup = SearchSysCache1(PUBLICATIONREL, ObjectIdGetDatum(proid));
@ -490,7 +490,7 @@ RemovePublicationRelById(Oid proid)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -517,7 +517,7 @@ OpenTableList(List *tables)
/* Allow query cancel in case this takes a long time */
CHECK_FOR_INTERRUPTS();
rel = heap_openrv(rv, ShareUpdateExclusiveLock);
rel = table_openrv(rv, ShareUpdateExclusiveLock);
myrelid = RelationGetRelid(rel);
/*
@ -529,7 +529,7 @@ OpenTableList(List *tables)
*/
if (list_member_oid(relids, myrelid))
{
heap_close(rel, ShareUpdateExclusiveLock);
table_close(rel, ShareUpdateExclusiveLock);
continue;
}
@ -560,7 +560,7 @@ OpenTableList(List *tables)
continue;
/* find_all_inheritors already got lock */
rel = heap_open(childrelid, NoLock);
rel = table_open(childrelid, NoLock);
rels = lappend(rels, rel);
relids = lappend_oid(relids, childrelid);
}
@ -584,7 +584,7 @@ CloseTableList(List *rels)
{
Relation rel = (Relation) lfirst(lc);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
}
@ -718,7 +718,7 @@ AlterPublicationOwner(const char *name, Oid newOwnerId)
ObjectAddress address;
Form_pg_publication pubform;
rel = heap_open(PublicationRelationId, RowExclusiveLock);
rel = table_open(PublicationRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PUBLICATIONNAME, CStringGetDatum(name));
@ -736,7 +736,7 @@ AlterPublicationOwner(const char *name, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -750,7 +750,7 @@ AlterPublicationOwner_oid(Oid subid, Oid newOwnerId)
HeapTuple tup;
Relation rel;
rel = heap_open(PublicationRelationId, RowExclusiveLock);
rel = table_open(PublicationRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(PUBLICATIONOID, ObjectIdGetDatum(subid));
@ -763,5 +763,5 @@ AlterPublicationOwner_oid(Oid subid, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}

View File

@ -220,7 +220,7 @@ RemoveSchemaById(Oid schemaOid)
Relation relation;
HeapTuple tup;
relation = heap_open(NamespaceRelationId, RowExclusiveLock);
relation = table_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache1(NAMESPACEOID,
ObjectIdGetDatum(schemaOid));
@ -231,7 +231,7 @@ RemoveSchemaById(Oid schemaOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
@ -248,7 +248,7 @@ RenameSchema(const char *oldname, const char *newname)
ObjectAddress address;
Form_pg_namespace nspform;
rel = heap_open(NamespaceRelationId, RowExclusiveLock);
rel = table_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(NAMESPACENAME, CStringGetDatum(oldname));
if (!HeapTupleIsValid(tup))
@ -290,7 +290,7 @@ RenameSchema(const char *oldname, const char *newname)
ObjectAddressSet(address, NamespaceRelationId, nspOid);
heap_close(rel, NoLock);
table_close(rel, NoLock);
heap_freetuple(tup);
return address;
@ -302,7 +302,7 @@ AlterSchemaOwner_oid(Oid oid, Oid newOwnerId)
HeapTuple tup;
Relation rel;
rel = heap_open(NamespaceRelationId, RowExclusiveLock);
rel = table_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache1(NAMESPACEOID, ObjectIdGetDatum(oid));
if (!HeapTupleIsValid(tup))
@ -312,7 +312,7 @@ AlterSchemaOwner_oid(Oid oid, Oid newOwnerId)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
@ -328,7 +328,7 @@ AlterSchemaOwner(const char *name, Oid newOwnerId)
ObjectAddress address;
Form_pg_namespace nspform;
rel = heap_open(NamespaceRelationId, RowExclusiveLock);
rel = table_open(NamespaceRelationId, RowExclusiveLock);
tup = SearchSysCache1(NAMESPACENAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
@ -345,7 +345,7 @@ AlterSchemaOwner(const char *name, Oid newOwnerId)
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}

View File

@ -168,7 +168,7 @@ GetSharedSecurityLabel(const ObjectAddress *object, const char *provider)
BTEqualStrategyNumber, F_TEXTEQ,
CStringGetTextDatum(provider));
pg_shseclabel = heap_open(SharedSecLabelRelationId, AccessShareLock);
pg_shseclabel = table_open(SharedSecLabelRelationId, AccessShareLock);
scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId, true,
NULL, 3, keys);
@ -183,7 +183,7 @@ GetSharedSecurityLabel(const ObjectAddress *object, const char *provider)
}
systable_endscan(scan);
heap_close(pg_shseclabel, AccessShareLock);
table_close(pg_shseclabel, AccessShareLock);
return seclabel;
}
@ -225,7 +225,7 @@ GetSecurityLabel(const ObjectAddress *object, const char *provider)
BTEqualStrategyNumber, F_TEXTEQ,
CStringGetTextDatum(provider));
pg_seclabel = heap_open(SecLabelRelationId, AccessShareLock);
pg_seclabel = table_open(SecLabelRelationId, AccessShareLock);
scan = systable_beginscan(pg_seclabel, SecLabelObjectIndexId, true,
NULL, 4, keys);
@ -240,7 +240,7 @@ GetSecurityLabel(const ObjectAddress *object, const char *provider)
}
systable_endscan(scan);
heap_close(pg_seclabel, AccessShareLock);
table_close(pg_seclabel, AccessShareLock);
return seclabel;
}
@ -285,7 +285,7 @@ SetSharedSecurityLabel(const ObjectAddress *object,
BTEqualStrategyNumber, F_TEXTEQ,
CStringGetTextDatum(provider));
pg_shseclabel = heap_open(SharedSecLabelRelationId, RowExclusiveLock);
pg_shseclabel = table_open(SharedSecLabelRelationId, RowExclusiveLock);
scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId, true,
NULL, 3, keys);
@ -316,7 +316,7 @@ SetSharedSecurityLabel(const ObjectAddress *object,
if (newtup != NULL)
heap_freetuple(newtup);
heap_close(pg_shseclabel, RowExclusiveLock);
table_close(pg_shseclabel, RowExclusiveLock);
}
/*
@ -372,7 +372,7 @@ SetSecurityLabel(const ObjectAddress *object,
BTEqualStrategyNumber, F_TEXTEQ,
CStringGetTextDatum(provider));
pg_seclabel = heap_open(SecLabelRelationId, RowExclusiveLock);
pg_seclabel = table_open(SecLabelRelationId, RowExclusiveLock);
scan = systable_beginscan(pg_seclabel, SecLabelObjectIndexId, true,
NULL, 4, keys);
@ -404,7 +404,7 @@ SetSecurityLabel(const ObjectAddress *object,
if (newtup != NULL)
heap_freetuple(newtup);
heap_close(pg_seclabel, RowExclusiveLock);
table_close(pg_seclabel, RowExclusiveLock);
}
/*
@ -428,7 +428,7 @@ DeleteSharedSecurityLabel(Oid objectId, Oid classId)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(classId));
pg_shseclabel = heap_open(SharedSecLabelRelationId, RowExclusiveLock);
pg_shseclabel = table_open(SharedSecLabelRelationId, RowExclusiveLock);
scan = systable_beginscan(pg_shseclabel, SharedSecLabelObjectIndexId, true,
NULL, 2, skey);
@ -436,7 +436,7 @@ DeleteSharedSecurityLabel(Oid objectId, Oid classId)
CatalogTupleDelete(pg_shseclabel, &oldtup->t_self);
systable_endscan(scan);
heap_close(pg_shseclabel, RowExclusiveLock);
table_close(pg_shseclabel, RowExclusiveLock);
}
/*
@ -479,7 +479,7 @@ DeleteSecurityLabel(const ObjectAddress *object)
else
nkeys = 2;
pg_seclabel = heap_open(SecLabelRelationId, RowExclusiveLock);
pg_seclabel = table_open(SecLabelRelationId, RowExclusiveLock);
scan = systable_beginscan(pg_seclabel, SecLabelObjectIndexId, true,
NULL, nkeys, skey);
@ -487,7 +487,7 @@ DeleteSecurityLabel(const ObjectAddress *object)
CatalogTupleDelete(pg_seclabel, &oldtup->t_self);
systable_endscan(scan);
heap_close(pg_seclabel, RowExclusiveLock);
table_close(pg_seclabel, RowExclusiveLock);
}
void

View File

@ -217,7 +217,7 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
seqoid = address.objectId;
Assert(seqoid != InvalidOid);
rel = heap_open(seqoid, AccessExclusiveLock);
rel = table_open(seqoid, AccessExclusiveLock);
tupDesc = RelationGetDescr(rel);
/* now initialize the sequence's data */
@ -228,10 +228,10 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
if (owned_by)
process_owned_by(rel, owned_by, seq->for_identity);
heap_close(rel, NoLock);
table_close(rel, NoLock);
/* fill in pg_sequence */
rel = heap_open(SequenceRelationId, RowExclusiveLock);
rel = table_open(SequenceRelationId, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
memset(pgs_nulls, 0, sizeof(pgs_nulls));
@ -249,7 +249,7 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
CatalogTupleInsert(rel, tuple);
heap_freetuple(tuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -446,7 +446,7 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
init_sequence(relid, &elm, &seqrel);
rel = heap_open(SequenceRelationId, RowExclusiveLock);
rel = table_open(SequenceRelationId, RowExclusiveLock);
seqtuple = SearchSysCacheCopy1(SEQRELID,
ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(seqtuple))
@ -506,7 +506,7 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
ObjectAddressSet(address, RelationRelationId, relid);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
relation_close(seqrel, NoLock);
return address;
@ -518,7 +518,7 @@ DeleteSequenceTuple(Oid relid)
Relation rel;
HeapTuple tuple;
rel = heap_open(SequenceRelationId, RowExclusiveLock);
rel = table_open(SequenceRelationId, RowExclusiveLock);
tuple = SearchSysCache1(SEQRELID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
@ -527,7 +527,7 @@ DeleteSequenceTuple(Oid relid)
CatalogTupleDelete(rel, &tuple->t_self);
ReleaseSysCache(tuple);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*

View File

@ -308,7 +308,7 @@ CreateStatistics(CreateStatsStmt *stmt)
Assert(ntypes > 0 && ntypes <= lengthof(types));
stxkind = construct_array(types, ntypes, CHAROID, 1, true, 'c');
statrel = heap_open(StatisticExtRelationId, RowExclusiveLock);
statrel = table_open(StatisticExtRelationId, RowExclusiveLock);
/*
* Everything seems fine, so let's build the pg_statistic_ext tuple.
@ -396,7 +396,7 @@ RemoveStatisticsById(Oid statsOid)
* Delete the pg_statistic_ext tuple. Also send out a cache inval on the
* associated table, so that dependent plans will be rebuilt.
*/
relation = heap_open(StatisticExtRelationId, RowExclusiveLock);
relation = table_open(StatisticExtRelationId, RowExclusiveLock);
tup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(statsOid));
@ -412,7 +412,7 @@ RemoveStatisticsById(Oid statsOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/*

View File

@ -347,7 +347,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to create subscriptions"))));
rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Check if name is used */
subid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
@ -491,7 +491,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION to "
"subscribe the tables")));
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
if (enabled)
ApplyLauncherWakeupAtCommit();
@ -626,7 +626,7 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
Subscription *sub;
Form_pg_subscription form;
rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Fetch the existing tuple. */
tup = SearchSysCacheCopy2(SUBSCRIPTIONNAME, MyDatabaseId,
@ -799,7 +799,7 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
heap_freetuple(tup);
}
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
ObjectAddressSet(myself, SubscriptionRelationId, subid);
@ -836,14 +836,14 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
* Lock pg_subscription with AccessExclusiveLock to ensure that the
* launcher doesn't restart new worker during dropping the subscription
*/
rel = heap_open(SubscriptionRelationId, AccessExclusiveLock);
rel = table_open(SubscriptionRelationId, AccessExclusiveLock);
tup = SearchSysCache2(SUBSCRIPTIONNAME, MyDatabaseId,
CStringGetDatum(stmt->subname));
if (!HeapTupleIsValid(tup))
{
heap_close(rel, NoLock);
table_close(rel, NoLock);
if (!stmt->missing_ok)
ereport(ERROR,
@ -962,7 +962,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
*/
if (!slotname)
{
heap_close(rel, NoLock);
table_close(rel, NoLock);
return;
}
@ -1014,7 +1014,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
pfree(cmd.data);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -1066,7 +1066,7 @@ AlterSubscriptionOwner(const char *name, Oid newOwnerId)
ObjectAddress address;
Form_pg_subscription form;
rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy2(SUBSCRIPTIONNAME, MyDatabaseId,
CStringGetDatum(name));
@ -1085,7 +1085,7 @@ AlterSubscriptionOwner(const char *name, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -1099,7 +1099,7 @@ AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId)
HeapTuple tup;
Relation rel;
rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(SUBSCRIPTIONOID, ObjectIdGetDatum(subid));
@ -1112,7 +1112,7 @@ AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId)
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -323,7 +323,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
* lock the proposed tablename against other would-be creators. The
* insertion will roll back if we find problems below.
*/
rel = heap_open(TableSpaceRelationId, RowExclusiveLock);
rel = table_open(TableSpaceRelationId, RowExclusiveLock);
MemSet(nulls, false, sizeof(nulls));
@ -385,7 +385,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
pfree(location);
/* We keep the lock on pg_tablespace until commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
return tablespaceoid;
#else /* !HAVE_SYMLINK */
@ -416,7 +416,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
/*
* Find the target tuple
*/
rel = heap_open(TableSpaceRelationId, RowExclusiveLock);
rel = table_open(TableSpaceRelationId, RowExclusiveLock);
ScanKeyInit(&entry[0],
Anum_pg_tablespace_spcname,
@ -441,7 +441,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
tablespacename)));
/* XXX I assume I need one or both of these next two calls */
heap_endscan(scandesc);
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
return;
}
@ -551,7 +551,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
LWLockRelease(TablespaceCreateLock);
/* We keep the lock on pg_tablespace until commit */
heap_close(rel, NoLock);
table_close(rel, NoLock);
#else /* !HAVE_SYMLINK */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@ -926,7 +926,7 @@ RenameTableSpace(const char *oldname, const char *newname)
ObjectAddress address;
/* Search pg_tablespace */
rel = heap_open(TableSpaceRelationId, RowExclusiveLock);
rel = table_open(TableSpaceRelationId, RowExclusiveLock);
ScanKeyInit(&entry[0],
Anum_pg_tablespace_spcname,
@ -981,7 +981,7 @@ RenameTableSpace(const char *oldname, const char *newname)
ObjectAddressSet(address, TableSpaceRelationId, tspId);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
@ -1006,7 +1006,7 @@ AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt)
HeapTuple newtuple;
/* Search pg_tablespace */
rel = heap_open(TableSpaceRelationId, RowExclusiveLock);
rel = table_open(TableSpaceRelationId, RowExclusiveLock);
ScanKeyInit(&entry[0],
Anum_pg_tablespace_spcname,
@ -1055,7 +1055,7 @@ AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt)
/* Conclude heap scan. */
heap_endscan(scandesc);
heap_close(rel, NoLock);
table_close(rel, NoLock);
return tablespaceoid;
}
@ -1397,7 +1397,7 @@ get_tablespace_oid(const char *tablespacename, bool missing_ok)
* index on name, on the theory that pg_tablespace will usually have just
* a few entries and so an indexed lookup is a waste of effort.
*/
rel = heap_open(TableSpaceRelationId, AccessShareLock);
rel = table_open(TableSpaceRelationId, AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_tablespace_spcname,
@ -1413,7 +1413,7 @@ get_tablespace_oid(const char *tablespacename, bool missing_ok)
result = InvalidOid;
heap_endscan(scandesc);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
if (!OidIsValid(result) && !missing_ok)
ereport(ERROR,
@ -1443,7 +1443,7 @@ get_tablespace_name(Oid spc_oid)
* index on oid, on the theory that pg_tablespace will usually have just a
* few entries and so an indexed lookup is a waste of effort.
*/
rel = heap_open(TableSpaceRelationId, AccessShareLock);
rel = table_open(TableSpaceRelationId, AccessShareLock);
ScanKeyInit(&entry[0],
Anum_pg_tablespace_oid,
@ -1459,7 +1459,7 @@ get_tablespace_name(Oid spc_oid)
result = NULL;
heap_endscan(scandesc);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return result;
}

View File

@ -189,9 +189,9 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
bool partition_recurse;
if (OidIsValid(relOid))
rel = heap_open(relOid, ShareRowExclusiveLock);
rel = table_open(relOid, ShareRowExclusiveLock);
else
rel = heap_openrv(stmt->relation, ShareRowExclusiveLock);
rel = table_openrv(stmt->relation, ShareRowExclusiveLock);
/*
* Triggers must be on tables or views, and there are additional
@ -712,7 +712,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
RI_FKey_trigger_type(funcoid) != RI_TRIGGER_NONE)
{
/* Keep lock on target rel until end of xact */
heap_close(rel, NoLock);
table_close(rel, NoLock);
ConvertTriggerToFK(stmt, funcoid);
@ -762,7 +762,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
* Generate the trigger's OID now, so that we can use it in the name if
* needed.
*/
tgrel = heap_open(TriggerRelationId, RowExclusiveLock);
tgrel = table_open(TriggerRelationId, RowExclusiveLock);
trigoid = GetNewOidWithIndex(tgrel, TriggerOidIndexId,
Anum_pg_trigger_oid);
@ -948,7 +948,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
CatalogTupleInsert(tgrel, tuple);
heap_freetuple(tuple);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
pfree(DatumGetPointer(values[Anum_pg_trigger_tgname - 1]));
pfree(DatumGetPointer(values[Anum_pg_trigger_tgargs - 1]));
@ -962,7 +962,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
* Update relation's pg_class entry; if necessary; and if not, send an SI
* message to make other backends (and this one) rebuild relcache entries.
*/
pgrel = heap_open(RelationRelationId, RowExclusiveLock);
pgrel = table_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(RELOID,
ObjectIdGetDatum(RelationGetRelid(rel)));
if (!HeapTupleIsValid(tuple))
@ -980,7 +980,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
CacheInvalidateRelcacheByTuple(tuple);
heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
table_close(pgrel, RowExclusiveLock);
/*
* Record dependencies for trigger. Always place a normal dependency on
@ -1128,7 +1128,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
Node *qual;
bool found_whole_row;
childTbl = heap_open(partdesc->oids[i], ShareRowExclusiveLock);
childTbl = table_open(partdesc->oids[i], ShareRowExclusiveLock);
/* Find which of the child indexes is the one on this partition */
if (OidIsValid(indexOid))
@ -1177,7 +1177,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
funcoid, trigoid, qual,
isInternal, true);
heap_close(childTbl, NoLock);
table_close(childTbl, NoLock);
MemoryContextReset(perChildCxt);
}
@ -1189,7 +1189,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
}
/* Keep lock on target rel until end of xact */
heap_close(rel, NoLock);
table_close(rel, NoLock);
return myself;
}
@ -1487,7 +1487,7 @@ RemoveTriggerById(Oid trigOid)
Oid relid;
Relation rel;
tgrel = heap_open(TriggerRelationId, RowExclusiveLock);
tgrel = table_open(TriggerRelationId, RowExclusiveLock);
/*
* Find the trigger to delete.
@ -1509,7 +1509,7 @@ RemoveTriggerById(Oid trigOid)
*/
relid = ((Form_pg_trigger) GETSTRUCT(tup))->tgrelid;
rel = heap_open(relid, AccessExclusiveLock);
rel = table_open(relid, AccessExclusiveLock);
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_VIEW &&
@ -1532,7 +1532,7 @@ RemoveTriggerById(Oid trigOid)
CatalogTupleDelete(tgrel, &tup->t_self);
systable_endscan(tgscan);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
/*
* We do not bother to try to determine whether any other triggers remain,
@ -1546,7 +1546,7 @@ RemoveTriggerById(Oid trigOid)
CacheInvalidateRelcache(rel);
/* Keep lock on trigger's rel until end of xact */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/*
@ -1567,7 +1567,7 @@ get_trigger_oid(Oid relid, const char *trigname, bool missing_ok)
/*
* Find the trigger, verify permissions, set up object address
*/
tgrel = heap_open(TriggerRelationId, AccessShareLock);
tgrel = table_open(TriggerRelationId, AccessShareLock);
ScanKeyInit(&skey[0],
Anum_pg_trigger_tgrelid,
@ -1598,7 +1598,7 @@ get_trigger_oid(Oid relid, const char *trigname, bool missing_ok)
}
systable_endscan(tgscan);
heap_close(tgrel, AccessShareLock);
table_close(tgrel, AccessShareLock);
return oid;
}
@ -1684,7 +1684,7 @@ renametrig(RenameStmt *stmt)
* NOTE that this is cool only because we have AccessExclusiveLock on the
* relation, so the trigger set won't be changing underneath us.
*/
tgrel = heap_open(TriggerRelationId, RowExclusiveLock);
tgrel = table_open(TriggerRelationId, RowExclusiveLock);
/*
* First pass -- look for name conflict
@ -1757,7 +1757,7 @@ renametrig(RenameStmt *stmt)
systable_endscan(tgscan);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
/*
* Close rel, but keep exclusive lock!
@ -1798,7 +1798,7 @@ EnableDisableTrigger(Relation rel, const char *tgname,
bool changed;
/* Scan the relevant entries in pg_triggers */
tgrel = heap_open(TriggerRelationId, RowExclusiveLock);
tgrel = table_open(TriggerRelationId, RowExclusiveLock);
ScanKeyInit(&keys[0],
Anum_pg_trigger_tgrelid,
@ -1867,7 +1867,7 @@ EnableDisableTrigger(Relation rel, const char *tgname,
part = relation_open(partdesc->oids[i], lockmode);
EnableDisableTrigger(part, NameStr(oldtrig->tgname),
fires_when, skip_system, lockmode);
heap_close(part, NoLock); /* keep lock till commit */
table_close(part, NoLock); /* keep lock till commit */
}
}
@ -1880,7 +1880,7 @@ EnableDisableTrigger(Relation rel, const char *tgname,
systable_endscan(tgscan);
heap_close(tgrel, RowExclusiveLock);
table_close(tgrel, RowExclusiveLock);
if (tgname && !found)
ereport(ERROR,
@ -1941,7 +1941,7 @@ RelationBuildTriggers(Relation relation)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(RelationGetRelid(relation)));
tgrel = heap_open(TriggerRelationId, AccessShareLock);
tgrel = table_open(TriggerRelationId, AccessShareLock);
tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true,
NULL, 1, &skey);
@ -2031,7 +2031,7 @@ RelationBuildTriggers(Relation relation)
}
systable_endscan(tgscan);
heap_close(tgrel, AccessShareLock);
table_close(tgrel, AccessShareLock);
/* There might not be any triggers */
if (numtrigs == 0)
@ -5403,7 +5403,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
* A constraint in a partitioned table may have corresponding
* constraints in the partitions. Grab those too.
*/
conrel = heap_open(ConstraintRelationId, AccessShareLock);
conrel = table_open(ConstraintRelationId, AccessShareLock);
foreach(lc, stmt->constraints)
{
@ -5525,13 +5525,13 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
systable_endscan(scan);
}
heap_close(conrel, AccessShareLock);
table_close(conrel, AccessShareLock);
/*
* Now, locate the trigger(s) implementing each of these constraints,
* and make a list of their OIDs.
*/
tgrel = heap_open(TriggerRelationId, AccessShareLock);
tgrel = table_open(TriggerRelationId, AccessShareLock);
foreach(lc, conoidlist)
{
@ -5575,7 +5575,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
conoid);
}
heap_close(tgrel, AccessShareLock);
table_close(tgrel, AccessShareLock);
/*
* Now we can set the trigger states of individual triggers for this

View File

@ -192,7 +192,7 @@ DefineTSParser(List *names, List *parameters)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to create text search parsers")));
prsRel = heap_open(TSParserRelationId, RowExclusiveLock);
prsRel = table_open(TSParserRelationId, RowExclusiveLock);
/* Convert list of names to a name and namespace */
namespaceoid = QualifiedNameGetCreationNamespace(names, &prsname);
@ -284,7 +284,7 @@ DefineTSParser(List *names, List *parameters)
heap_freetuple(tup);
heap_close(prsRel, RowExclusiveLock);
table_close(prsRel, RowExclusiveLock);
return address;
}
@ -298,7 +298,7 @@ RemoveTSParserById(Oid prsId)
Relation relation;
HeapTuple tup;
relation = heap_open(TSParserRelationId, RowExclusiveLock);
relation = table_open(TSParserRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
@ -309,7 +309,7 @@ RemoveTSParserById(Oid prsId)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/* ---------------------- TS Dictionary commands -----------------------*/
@ -464,7 +464,7 @@ DefineTSDictionary(List *names, List *parameters)
verify_dictoptions(templId, dictoptions);
dictRel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
dictRel = table_open(TSDictionaryRelationId, RowExclusiveLock);
/*
* Looks good, insert
@ -497,7 +497,7 @@ DefineTSDictionary(List *names, List *parameters)
heap_freetuple(tup);
heap_close(dictRel, RowExclusiveLock);
table_close(dictRel, RowExclusiveLock);
return address;
}
@ -511,7 +511,7 @@ RemoveTSDictionaryById(Oid dictId)
Relation relation;
HeapTuple tup;
relation = heap_open(TSDictionaryRelationId, RowExclusiveLock);
relation = table_open(TSDictionaryRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
@ -523,7 +523,7 @@ RemoveTSDictionaryById(Oid dictId)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/*
@ -547,7 +547,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
dictId = get_ts_dict_oid(stmt->dictname, false);
rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
rel = table_open(TSDictionaryRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
@ -639,7 +639,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
heap_freetuple(newtup);
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -756,7 +756,7 @@ DefineTSTemplate(List *names, List *parameters)
/* Convert list of names to a name and namespace */
namespaceoid = QualifiedNameGetCreationNamespace(names, &tmplname);
tmplRel = heap_open(TSTemplateRelationId, RowExclusiveLock);
tmplRel = table_open(TSTemplateRelationId, RowExclusiveLock);
for (i = 0; i < Natts_pg_ts_template; i++)
{
@ -819,7 +819,7 @@ DefineTSTemplate(List *names, List *parameters)
heap_freetuple(tup);
heap_close(tmplRel, RowExclusiveLock);
table_close(tmplRel, RowExclusiveLock);
return address;
}
@ -833,7 +833,7 @@ RemoveTSTemplateById(Oid tmplId)
Relation relation;
HeapTuple tup;
relation = heap_open(TSTemplateRelationId, RowExclusiveLock);
relation = table_open(TSTemplateRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
@ -845,7 +845,7 @@ RemoveTSTemplateById(Oid tmplId)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
/* ---------------------- TS Configuration commands -----------------------*/
@ -1052,7 +1052,7 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("text search parser is required")));
cfgRel = heap_open(TSConfigRelationId, RowExclusiveLock);
cfgRel = table_open(TSConfigRelationId, RowExclusiveLock);
/*
* Looks good, build tuple and insert
@ -1082,7 +1082,7 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
SysScanDesc scan;
HeapTuple maptup;
mapRel = heap_open(TSConfigMapRelationId, RowExclusiveLock);
mapRel = table_open(TSConfigMapRelationId, RowExclusiveLock);
ScanKeyInit(&skey,
Anum_pg_ts_config_map_mapcfg,
@ -1125,8 +1125,8 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
heap_freetuple(tup);
if (mapRel)
heap_close(mapRel, RowExclusiveLock);
heap_close(cfgRel, RowExclusiveLock);
table_close(mapRel, RowExclusiveLock);
table_close(cfgRel, RowExclusiveLock);
return address;
}
@ -1144,7 +1144,7 @@ RemoveTSConfigurationById(Oid cfgId)
SysScanDesc scan;
/* Remove the pg_ts_config entry */
relCfg = heap_open(TSConfigRelationId, RowExclusiveLock);
relCfg = table_open(TSConfigRelationId, RowExclusiveLock);
tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
@ -1156,10 +1156,10 @@ RemoveTSConfigurationById(Oid cfgId)
ReleaseSysCache(tup);
heap_close(relCfg, RowExclusiveLock);
table_close(relCfg, RowExclusiveLock);
/* Remove any pg_ts_config_map entries */
relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock);
relMap = table_open(TSConfigMapRelationId, RowExclusiveLock);
ScanKeyInit(&skey,
Anum_pg_ts_config_map_mapcfg,
@ -1176,7 +1176,7 @@ RemoveTSConfigurationById(Oid cfgId)
systable_endscan(scan);
heap_close(relMap, RowExclusiveLock);
table_close(relMap, RowExclusiveLock);
}
/*
@ -1205,7 +1205,7 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_TSCONFIGURATION,
NameListToString(stmt->cfgname));
relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock);
relMap = table_open(TSConfigMapRelationId, RowExclusiveLock);
/* Add or drop mappings */
if (stmt->dicts)
@ -1220,7 +1220,7 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
ObjectAddressSet(address, TSConfigRelationId, cfgId);
heap_close(relMap, RowExclusiveLock);
table_close(relMap, RowExclusiveLock);
ReleaseSysCache(tup);

View File

@ -691,7 +691,7 @@ RemoveTypeById(Oid typeOid)
Relation relation;
HeapTuple tup;
relation = heap_open(TypeRelationId, RowExclusiveLock);
relation = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@ -717,7 +717,7 @@ RemoveTypeById(Oid typeOid)
ReleaseSysCache(tup);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
}
@ -2091,11 +2091,11 @@ AssignTypeArrayOid(void)
}
else
{
Relation pg_type = heap_open(TypeRelationId, AccessShareLock);
Relation pg_type = table_open(TypeRelationId, AccessShareLock);
type_array_oid = GetNewOidWithIndex(pg_type, TypeOidIndexId,
Anum_pg_type_oid);
heap_close(pg_type, AccessShareLock);
table_close(pg_type, AccessShareLock);
}
return type_array_oid;
@ -2198,7 +2198,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@ -2300,7 +2300,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
heap_freetuple(newtuple);
return address;
@ -2328,7 +2328,7 @@ AlterDomainNotNull(List *names, bool notNull)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
typrel = heap_open(TypeRelationId, RowExclusiveLock);
typrel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@ -2341,7 +2341,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Is the domain already set to the desired constraint? */
if (typTup->typnotnull == notNull)
{
heap_close(typrel, RowExclusiveLock);
table_close(typrel, RowExclusiveLock);
return address;
}
@ -2401,7 +2401,7 @@ AlterDomainNotNull(List *names, bool notNull)
UnregisterSnapshot(snapshot);
/* Close each rel after processing, but keep lock */
heap_close(testrel, NoLock);
table_close(testrel, NoLock);
}
}
@ -2419,7 +2419,7 @@ AlterDomainNotNull(List *names, bool notNull)
/* Clean up */
heap_freetuple(tup);
heap_close(typrel, RowExclusiveLock);
table_close(typrel, RowExclusiveLock);
return address;
}
@ -2451,7 +2451,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@ -2461,7 +2461,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
checkDomainOwner(tup);
/* Grab an appropriate lock on the pg_constraint relation */
conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
conrel = table_open(ConstraintRelationId, RowExclusiveLock);
/* Find and remove the target constraint */
ScanKeyInit(&skey[0],
@ -2495,7 +2495,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
/* Clean up after the scan */
systable_endscan(conscan);
heap_close(conrel, RowExclusiveLock);
table_close(conrel, RowExclusiveLock);
if (!found)
{
@ -2520,7 +2520,7 @@ AlterDomainDropConstraint(List *names, const char *constrName,
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -2548,7 +2548,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
typrel = heap_open(TypeRelationId, RowExclusiveLock);
typrel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@ -2636,7 +2636,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
ObjectAddressSet(address, TypeRelationId, domainoid);
/* Clean up */
heap_close(typrel, RowExclusiveLock);
table_close(typrel, RowExclusiveLock);
return address;
}
@ -2670,7 +2670,7 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
domainoid = typenameTypeId(NULL, typename);
/* Look up the domain in the type table */
typrel = heap_open(TypeRelationId, AccessShareLock);
typrel = table_open(TypeRelationId, AccessShareLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(domainoid));
if (!HeapTupleIsValid(tup))
@ -2682,7 +2682,7 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
/*
* Find and check the target constraint
*/
conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
conrel = table_open(ConstraintRelationId, RowExclusiveLock);
ScanKeyInit(&skey[0],
Anum_pg_constraint_conrelid,
@ -2740,8 +2740,8 @@ AlterDomainValidateConstraint(List *names, const char *constrName)
systable_endscan(scan);
heap_close(typrel, AccessShareLock);
heap_close(conrel, RowExclusiveLock);
table_close(typrel, AccessShareLock);
table_close(conrel, RowExclusiveLock);
ReleaseSysCache(tup);
@ -2829,7 +2829,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin)
UnregisterSnapshot(snapshot);
/* Hold relation lock till commit (XXX bad for concurrency) */
heap_close(testrel, NoLock);
table_close(testrel, NoLock);
}
FreeExecutorState(estate);
@ -2885,7 +2885,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
* We scan pg_depend to find those things that depend on the domain. (We
* assume we can ignore refobjsubid for a domain.)
*/
depRel = heap_open(DependRelationId, AccessShareLock);
depRel = table_open(DependRelationId, AccessShareLock);
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
@ -3227,7 +3227,7 @@ RenameType(RenameStmt *stmt)
typeOid = typenameTypeId(NULL, typename);
/* Look up the type in the type table */
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@ -3280,7 +3280,7 @@ RenameType(RenameStmt *stmt)
ObjectAddressSet(address, TypeRelationId, typeOid);
/* Clean up */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -3300,7 +3300,7 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
AclResult aclresult;
ObjectAddress address;
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
/* Make a TypeName so we can use standard type lookup machinery */
typename = makeTypeNameFromNameList(names);
@ -3381,7 +3381,7 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
ObjectAddressSet(address, TypeRelationId, typeOid);
/* Clean up */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
return address;
}
@ -3404,7 +3404,7 @@ AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
HeapTuple tup;
Form_pg_type typTup;
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@ -3428,7 +3428,7 @@ AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
InvokeObjectPostAlterHook(TypeRelationId, typeOid, 0);
ReleaseSysCache(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -3450,7 +3450,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
Datum aclDatum;
bool isNull;
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@ -3486,7 +3486,7 @@ AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
AlterTypeOwnerInternal(typTup->typarray, newOwnerId);
/* Clean up */
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
}
/*
@ -3591,7 +3591,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
if (object_address_present(&thisobj, objsMoved))
return InvalidOid;
rel = heap_open(TypeRelationId, RowExclusiveLock);
rel = table_open(TypeRelationId, RowExclusiveLock);
tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeOid));
if (!HeapTupleIsValid(tup))
@ -3652,13 +3652,13 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
{
Relation classRel;
classRel = heap_open(RelationRelationId, RowExclusiveLock);
classRel = table_open(RelationRelationId, RowExclusiveLock);
AlterRelationNamespaceInternal(classRel, typform->typrelid,
oldNspOid, nspOid,
false, objsMoved);
heap_close(classRel, RowExclusiveLock);
table_close(classRel, RowExclusiveLock);
/*
* Check for constraints associated with the composite type (we don't
@ -3691,7 +3691,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
heap_freetuple(tup);
heap_close(rel, RowExclusiveLock);
table_close(rel, RowExclusiveLock);
add_exact_object_address(&thisobj, objsMoved);

View File

@ -331,7 +331,7 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
* Check the pg_authid relation to be certain the role doesn't already
* exist.
*/
pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_rel = table_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_dsc = RelationGetDescr(pg_authid_rel);
if (OidIsValid(get_role_oid(stmt->role, true)))
@ -495,7 +495,7 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
/*
* Close pg_authid, but keep lock till commit.
*/
heap_close(pg_authid_rel, NoLock);
table_close(pg_authid_rel, NoLock);
return roleid;
}
@ -681,7 +681,7 @@ AlterRole(AlterRoleStmt *stmt)
/*
* Scan the pg_authid relation to be certain the user exists.
*/
pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_rel = table_open(AuthIdRelationId, RowExclusiveLock);
pg_authid_dsc = RelationGetDescr(pg_authid_rel);
tuple = get_rolespec_tuple(stmt->role);
@ -881,7 +881,7 @@ AlterRole(AlterRoleStmt *stmt)
/*
* Close pg_authid, but keep lock till commit.
*/
heap_close(pg_authid_rel, NoLock);
table_close(pg_authid_rel, NoLock);
return roleid;
}
@ -987,8 +987,8 @@ DropRole(DropRoleStmt *stmt)
* Scan the pg_authid relation to find the Oid of the role(s) to be
* deleted.
*/
pg_authid_rel = heap_open(AuthIdRelationId, RowExclusiveLock);
pg_auth_members_rel = heap_open(AuthMemRelationId, RowExclusiveLock);
pg_authid_rel = table_open(AuthIdRelationId, RowExclusiveLock);
pg_auth_members_rel = table_open(AuthMemRelationId, RowExclusiveLock);
foreach(item, stmt->roles)
{
@ -1142,8 +1142,8 @@ DropRole(DropRoleStmt *stmt)
/*
* Now we can clean up; but keep locks until commit.
*/
heap_close(pg_auth_members_rel, NoLock);
heap_close(pg_authid_rel, NoLock);
table_close(pg_auth_members_rel, NoLock);
table_close(pg_authid_rel, NoLock);
}
/*
@ -1166,7 +1166,7 @@ RenameRole(const char *oldname, const char *newname)
ObjectAddress address;
Form_pg_authid authform;
rel = heap_open(AuthIdRelationId, RowExclusiveLock);
rel = table_open(AuthIdRelationId, RowExclusiveLock);
dsc = RelationGetDescr(rel);
oldtuple = SearchSysCache1(AUTHNAME, CStringGetDatum(oldname));
@ -1270,7 +1270,7 @@ RenameRole(const char *oldname, const char *newname)
/*
* Close pg_authid, but keep lock till commit.
*/
heap_close(rel, NoLock);
table_close(rel, NoLock);
return address;
}
@ -1296,7 +1296,7 @@ GrantRole(GrantRoleStmt *stmt)
grantee_ids = roleSpecsToIds(stmt->grantee_roles);
/* AccessShareLock is enough since we aren't modifying pg_authid */
pg_authid_rel = heap_open(AuthIdRelationId, AccessShareLock);
pg_authid_rel = table_open(AuthIdRelationId, AccessShareLock);
/*
* Step through all of the granted roles and add/remove entries for the
@ -1331,7 +1331,7 @@ GrantRole(GrantRoleStmt *stmt)
/*
* Close pg_authid, but keep lock till commit.
*/
heap_close(pg_authid_rel, NoLock);
table_close(pg_authid_rel, NoLock);
}
/*
@ -1483,7 +1483,7 @@ AddRoleMems(const char *rolename, Oid roleid,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to set grantor")));
pg_authmem_rel = heap_open(AuthMemRelationId, RowExclusiveLock);
pg_authmem_rel = table_open(AuthMemRelationId, RowExclusiveLock);
pg_authmem_dsc = RelationGetDescr(pg_authmem_rel);
forboth(specitem, memberSpecs, iditem, memberIds)
@ -1561,7 +1561,7 @@ AddRoleMems(const char *rolename, Oid roleid,
/*
* Close pg_authmem, but keep lock till commit.
*/
heap_close(pg_authmem_rel, NoLock);
table_close(pg_authmem_rel, NoLock);
}
/*
@ -1612,7 +1612,7 @@ DelRoleMems(const char *rolename, Oid roleid,
rolename)));
}
pg_authmem_rel = heap_open(AuthMemRelationId, RowExclusiveLock);
pg_authmem_rel = table_open(AuthMemRelationId, RowExclusiveLock);
pg_authmem_dsc = RelationGetDescr(pg_authmem_rel);
forboth(specitem, memberSpecs, iditem, memberIds)
@ -1671,5 +1671,5 @@ DelRoleMems(const char *rolename, Oid roleid,
/*
* Close pg_authmem, but keep lock till commit.
*/
heap_close(pg_authmem_rel, NoLock);
table_close(pg_authmem_rel, NoLock);
}

View File

@ -749,7 +749,7 @@ get_all_vacuum_rels(int options)
HeapScanDesc scan;
HeapTuple tuple;
pgclass = heap_open(RelationRelationId, AccessShareLock);
pgclass = table_open(RelationRelationId, AccessShareLock);
scan = heap_beginscan_catalog(pgclass, 0, NULL);
@ -786,7 +786,7 @@ get_all_vacuum_rels(int options)
}
heap_endscan(scan);
heap_close(pgclass, AccessShareLock);
table_close(pgclass, AccessShareLock);
return vacrels;
}
@ -1097,7 +1097,7 @@ vac_update_relstats(Relation relation,
Form_pg_class pgcform;
bool dirty;
rd = heap_open(RelationRelationId, RowExclusiveLock);
rd = table_open(RelationRelationId, RowExclusiveLock);
/* Fetch a copy of the tuple to scribble on */
ctup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
@ -1188,7 +1188,7 @@ vac_update_relstats(Relation relation,
if (dirty)
heap_inplace_update(rd, ctup);
heap_close(rd, RowExclusiveLock);
table_close(rd, RowExclusiveLock);
}
@ -1251,7 +1251,7 @@ vac_update_datfrozenxid(void)
* We must seqscan pg_class to find the minimum Xid, because there is no
* index that can help us here.
*/
relation = heap_open(RelationRelationId, AccessShareLock);
relation = table_open(RelationRelationId, AccessShareLock);
scan = systable_beginscan(relation, InvalidOid, false,
NULL, 0, NULL);
@ -1296,7 +1296,7 @@ vac_update_datfrozenxid(void)
/* we're done with pg_class */
systable_endscan(scan);
heap_close(relation, AccessShareLock);
table_close(relation, AccessShareLock);
/* chicken out if bogus data found */
if (bogus)
@ -1306,7 +1306,7 @@ vac_update_datfrozenxid(void)
Assert(MultiXactIdIsValid(newMinMulti));
/* Now fetch the pg_database tuple we need to update. */
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
relation = table_open(DatabaseRelationId, RowExclusiveLock);
/* Fetch a copy of the tuple to scribble on */
tuple = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
@ -1344,7 +1344,7 @@ vac_update_datfrozenxid(void)
heap_inplace_update(relation, tuple);
heap_freetuple(tuple);
heap_close(relation, RowExclusiveLock);
table_close(relation, RowExclusiveLock);
/*
* If we were able to advance datfrozenxid or datminmxid, see if we can
@ -1411,7 +1411,7 @@ vac_truncate_clog(TransactionId frozenXID,
* worst possible outcome is that pg_xact is not truncated as aggressively
* as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
relation = table_open(DatabaseRelationId, AccessShareLock);
scan = heap_beginscan_catalog(relation, 0, NULL);
@ -1454,7 +1454,7 @@ vac_truncate_clog(TransactionId frozenXID,
heap_endscan(scan);
heap_close(relation, AccessShareLock);
table_close(relation, AccessShareLock);
/*
* Do not truncate CLOG if we seem to have suffered wraparound already;

View File

@ -1423,7 +1423,7 @@ ExecGetTriggerResultRel(EState *estate, Oid relid)
* event got queued, so we need take no new lock here. Also, we need not
* recheck the relkind, so no need for CheckValidResultRel.
*/
rel = heap_open(relid, NoLock);
rel = table_open(relid, NoLock);
/*
* Make the new entry in the right context.
@ -1472,7 +1472,7 @@ ExecCleanUpTriggerState(EState *estate)
*/
Assert(resultRelInfo->ri_NumIndices == 0);
heap_close(resultRelInfo->ri_RelationDesc, NoLock);
table_close(resultRelInfo->ri_RelationDesc, NoLock);
}
}
@ -1578,7 +1578,7 @@ ExecEndPlan(PlanState *planstate, EState *estate)
for (i = 0; i < num_relations; i++)
{
if (estate->es_relations[i])
heap_close(estate->es_relations[i], NoLock);
table_close(estate->es_relations[i], NoLock);
}
/* likewise close any trigger target relations */

View File

@ -514,7 +514,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
* We locked all the partitions in ExecSetupPartitionTupleRouting
* including the leaf partitions.
*/
partrel = heap_open(dispatch->partdesc->oids[partidx], NoLock);
partrel = table_open(dispatch->partdesc->oids[partidx], NoLock);
leaf_part_rri = makeNode(ResultRelInfo);
InitResultRelInfo(leaf_part_rri,
@ -983,7 +983,7 @@ ExecInitPartitionDispatchInfo(PartitionTupleRouting *proute, Oid partoid,
oldcxt = MemoryContextSwitchTo(proute->memcxt);
if (partoid != RelationGetRelid(proute->partition_root))
rel = heap_open(partoid, NoLock);
rel = table_open(partoid, NoLock);
else
rel = proute->partition_root;
partdesc = RelationGetPartitionDesc(rel);
@ -1087,7 +1087,7 @@ ExecCleanupTupleRouting(ModifyTableState *mtstate,
{
PartitionDispatch pd = proute->partition_dispatch_info[i];
heap_close(pd->reldesc, NoLock);
table_close(pd->reldesc, NoLock);
if (pd->tupslot)
ExecDropSingleTupleTableSlot(pd->tupslot);
@ -1120,7 +1120,7 @@ ExecCleanupTupleRouting(ModifyTableState *mtstate,
resultRelInfo);
ExecCloseIndices(resultRelInfo);
heap_close(resultRelInfo->ri_RelationDesc, NoLock);
table_close(resultRelInfo->ri_RelationDesc, NoLock);
}
}

View File

@ -776,11 +776,11 @@ ExecGetRangeTableRelation(EState *estate, Index rti)
/*
* In a normal query, we should already have the appropriate lock,
* but verify that through an Assert. Since there's already an
* Assert inside heap_open that insists on holding some lock, it
* Assert inside table_open that insists on holding some lock, it
* seems sufficient to check this only when rellockmode is higher
* than the minimum.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
Assert(rte->rellockmode == AccessShareLock ||
CheckRelationLockedByMe(rel, rte->rellockmode, false));
}
@ -791,7 +791,7 @@ ExecGetRangeTableRelation(EState *estate, Index rti)
* lock on the relation. This ensures sane behavior in case the
* parent process exits before we do.
*/
rel = heap_open(rte->relid, rte->rellockmode);
rel = table_open(rte->relid, rte->rellockmode);
}
estate->es_relations[rti - 1] = rel;

View File

@ -6192,7 +6192,7 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
/* Build RelOptInfo */
rel = build_simple_rel(root, 1, NULL);
heap = heap_open(tableOid, NoLock);
heap = table_open(tableOid, NoLock);
index = index_open(indexOid, NoLock);
/*
@ -6253,7 +6253,7 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
done:
index_close(index, NoLock);
heap_close(heap, NoLock);
table_close(heap, NoLock);
return parallel_workers;
}

View File

@ -94,7 +94,7 @@ preprocess_targetlist(PlannerInfo *root)
if (target_rte->rtekind != RTE_RELATION)
elog(ERROR, "result relation must be a regular relation");
target_relation = heap_open(target_rte->relid, NoLock);
target_relation = table_open(target_rte->relid, NoLock);
}
else
Assert(command_type == CMD_SELECT);
@ -233,7 +233,7 @@ preprocess_targetlist(PlannerInfo *root)
target_relation);
if (target_relation)
heap_close(target_relation, NoLock);
table_close(target_relation, NoLock);
return tlist;
}

View File

@ -158,7 +158,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
* Must open the parent relation to examine its tupdesc. We need not lock
* it; we assume the rewriter already did.
*/
oldrelation = heap_open(parentOID, NoLock);
oldrelation = table_open(parentOID, NoLock);
/* Scan the inheritance set and expand it */
if (RelationGetPartitionDesc(oldrelation) != NULL)
@ -191,7 +191,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
/* Open rel if needed; we already have required locks */
if (childOID != parentOID)
newrelation = heap_open(childOID, NoLock);
newrelation = table_open(childOID, NoLock);
else
newrelation = oldrelation;
@ -203,7 +203,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
*/
if (childOID != parentOID && RELATION_IS_OTHER_TEMP(newrelation))
{
heap_close(newrelation, lockmode);
table_close(newrelation, lockmode);
continue;
}
@ -214,7 +214,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
/* Close child relations, but keep locks */
if (childOID != parentOID)
heap_close(newrelation, NoLock);
table_close(newrelation, NoLock);
}
/*
@ -232,7 +232,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
}
heap_close(oldrelation, NoLock);
table_close(oldrelation, NoLock);
}
/*
@ -289,7 +289,7 @@ expand_partitioned_rtentry(PlannerInfo *root, RangeTblEntry *parentrte,
Relation childrel;
/* Open rel; we already have required locks */
childrel = heap_open(childOID, NoLock);
childrel = table_open(childOID, NoLock);
/*
* Temporary partitions belonging to other sessions should have been
@ -310,7 +310,7 @@ expand_partitioned_rtentry(PlannerInfo *root, RangeTblEntry *parentrte,
appinfos);
/* Close child relation, but keep locks */
heap_close(childrel, NoLock);
table_close(childrel, NoLock);
}
}

View File

@ -118,7 +118,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
* the rewriter or when expand_inherited_rtentry() added it to the query's
* rangetable.
*/
relation = heap_open(relationObjectId, NoLock);
relation = table_open(relationObjectId, NoLock);
/* Temporary and unlogged relations are inaccessible during recovery. */
if (!RelationNeedsWAL(relation) && RecoveryInProgress())
@ -450,7 +450,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
if (inhparent && relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
set_relation_partition_info(root, rel, relation);
heap_close(relation, NoLock);
table_close(relation, NoLock);
/*
* Allow a plugin to editorialize on the info we obtained from the
@ -621,7 +621,7 @@ infer_arbiter_indexes(PlannerInfo *root)
relationObjectId = rt_fetch(root->parse->resultRelation,
root->parse->rtable)->relid;
relation = heap_open(relationObjectId, NoLock);
relation = table_open(relationObjectId, NoLock);
/*
* Build normalized/BMS representation of plain indexed attributes, as
@ -720,7 +720,7 @@ infer_arbiter_indexes(PlannerInfo *root)
results = lappend_oid(results, idxForm->indexrelid);
list_free(indexList);
index_close(idxRel, NoLock);
heap_close(relation, NoLock);
table_close(relation, NoLock);
return results;
}
else if (indexOidFromConstraint != InvalidOid)
@ -815,7 +815,7 @@ next:
}
list_free(indexList);
heap_close(relation, NoLock);
table_close(relation, NoLock);
if (results == NIL)
ereport(ERROR,
@ -1143,11 +1143,11 @@ get_relation_data_width(Oid relid, int32 *attr_widths)
Relation relation;
/* As above, assume relation is already locked */
relation = heap_open(relid, NoLock);
relation = table_open(relid, NoLock);
result = get_rel_data_width(relation, attr_widths);
heap_close(relation, NoLock);
table_close(relation, NoLock);
return result;
}
@ -1183,7 +1183,7 @@ get_relation_constraints(PlannerInfo *root,
/*
* We assume the relation has already been safely locked.
*/
relation = heap_open(relationObjectId, NoLock);
relation = table_open(relationObjectId, NoLock);
constr = relation->rd_att->constr;
if (constr != NULL)
@ -1294,7 +1294,7 @@ get_relation_constraints(PlannerInfo *root,
}
}
heap_close(relation, NoLock);
table_close(relation, NoLock);
return result;
}
@ -1571,7 +1571,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
{
case RTE_RELATION:
/* Assume we already have adequate lock */
relation = heap_open(rte->relid, NoLock);
relation = table_open(rte->relid, NoLock);
numattrs = RelationGetNumberOfAttributes(relation);
for (attrno = 1; attrno <= numattrs; attrno++)
@ -1600,7 +1600,7 @@ build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
false));
}
heap_close(relation, NoLock);
table_close(relation, NoLock);
break;
case RTE_SUBQUERY:
@ -1857,7 +1857,7 @@ has_row_triggers(PlannerInfo *root, Index rti, CmdType event)
bool result = false;
/* Assume we already have adequate lock */
relation = heap_open(rte->relid, NoLock);
relation = table_open(rte->relid, NoLock);
trigDesc = relation->trigdesc;
switch (event)
@ -1885,7 +1885,7 @@ has_row_triggers(PlannerInfo *root, Index rti, CmdType event)
break;
}
heap_close(relation, NoLock);
table_close(relation, NoLock);
return result;
}

View File

@ -201,13 +201,13 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
/* Close old target; this could only happen for multi-action rules */
if (pstate->p_target_relation != NULL)
heap_close(pstate->p_target_relation, NoLock);
table_close(pstate->p_target_relation, NoLock);
/*
* Open target rel and grab suitable lock (which we will hold till end of
* transaction).
*
* free_parsestate() will eventually do the corresponding heap_close(),
* free_parsestate() will eventually do the corresponding table_close(),
* but *not* release the lock.
*/
pstate->p_target_relation = parserOpenTable(pstate, relation,

View File

@ -88,7 +88,7 @@ free_parsestate(ParseState *pstate)
MaxTupleAttributeNumber)));
if (pstate->p_target_relation != NULL)
heap_close(pstate->p_target_relation, NoLock);
table_close(pstate->p_target_relation, NoLock);
pfree(pstate);
}

View File

@ -1137,7 +1137,7 @@ chooseScalarFunctionAlias(Node *funcexpr, char *funcname,
/*
* Open a table during parse analysis
*
* This is essentially just the same as heap_openrv(), except that it caters
* This is essentially just the same as table_openrv(), except that it caters
* to some parser-specific error reporting needs, notably that it arranges
* to include the RangeVar's parse location in any resulting error.
*
@ -1152,7 +1152,7 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
ParseCallbackState pcbstate;
setup_parser_errposition_callback(&pcbstate, pstate, relation->location);
rel = heap_openrv_extended(relation, lockmode, true);
rel = table_openrv_extended(relation, lockmode, true);
if (rel == NULL)
{
if (relation->schemaname)
@ -1240,7 +1240,7 @@ addRangeTableEntry(ParseState *pstate,
* so that the table can't be deleted or have its schema modified
* underneath us.
*/
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* Set flags and access permissions.
@ -3096,7 +3096,7 @@ get_parse_rowmark(Query *qry, Index rtindex)
* Returns InvalidAttrNumber if the attr doesn't exist (or is dropped).
*
* This should only be used if the relation is already
* heap_open()'ed. Use the cache version get_attnum()
* table_open()'ed. Use the cache version get_attnum()
* for access to non-opened relations.
*/
int
@ -3146,7 +3146,7 @@ specialAttNum(const char *attname)
* given attribute id, return name of that attribute
*
* This should only be used if the relation is already
* heap_open()'ed. Use the cache version get_atttype()
* table_open()'ed. Use the cache version get_atttype()
* for access to non-opened relations.
*/
const NameData *
@ -3168,7 +3168,7 @@ attnumAttName(Relation rd, int attid)
* given attribute id, return type of that attribute
*
* This should only be used if the relation is already
* heap_open()'ed. Use the cache version get_atttype()
* table_open()'ed. Use the cache version get_atttype()
* for access to non-opened relations.
*/
Oid
@ -3189,7 +3189,7 @@ attnumTypeId(Relation rd, int attid)
/*
* given attribute id, return collation of that attribute
*
* This should only be used if the relation is already heap_open()'ed.
* This should only be used if the relation is already table_open()'ed.
*/
Oid
attnumCollationId(Relation rd, int attid)
@ -3361,10 +3361,10 @@ isQueryUsingTempRelation_walker(Node *node, void *context)
if (rte->rtekind == RTE_RELATION)
{
Relation rel = heap_open(rte->relid, AccessShareLock);
Relation rel = table_open(rte->relid, AccessShareLock);
char relpersistence = rel->rd_rel->relpersistence;
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
if (relpersistence == RELPERSISTENCE_TEMP)
return true;
}

View File

@ -1200,7 +1200,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
* commit. That will prevent someone else from deleting or ALTERing the
* parent before the child is committed.
*/
heap_close(relation, NoLock);
table_close(relation, NoLock);
}
static void
@ -2157,7 +2157,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
Relation rel;
int count;
rel = heap_openrv(inh, AccessShareLock);
rel = table_openrv(inh, AccessShareLock);
/* check user requested inheritance from valid relkind */
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
@ -2187,7 +2187,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
break;
}
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
if (found)
break;
}
@ -2280,7 +2280,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
Relation rel;
int count;
rel = heap_openrv(inh, AccessShareLock);
rel = table_openrv(inh, AccessShareLock);
/* check user requested inheritance from valid relkind */
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
@ -2310,7 +2310,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
break;
}
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
if (found)
break;
}
@ -2550,7 +2550,7 @@ transformIndexStmt(Oid relid, IndexStmt *stmt, const char *queryString)
free_parsestate(pstate);
/* Close relation */
heap_close(rel, NoLock);
table_close(rel, NoLock);
/* Mark statement as successfully transformed */
stmt->transformed = true;
@ -2586,7 +2586,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
* DefineQueryRewrite(), and we don't want to grab a lesser lock
* beforehand.
*/
rel = heap_openrv(stmt->relation, AccessExclusiveLock);
rel = table_openrv(stmt->relation, AccessExclusiveLock);
if (rel->rd_rel->relkind == RELKIND_MATVIEW)
ereport(ERROR,
@ -2864,7 +2864,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
free_parsestate(pstate);
/* Close relation, but keep the exclusive lock */
heap_close(rel, NoLock);
table_close(rel, NoLock);
}

View File

@ -1213,7 +1213,7 @@ check_default_partition_contents(Relation parent, Relation default_rel,
/* Lock already taken above. */
if (part_relid != RelationGetRelid(default_rel))
{
part_rel = heap_open(part_relid, NoLock);
part_rel = table_open(part_relid, NoLock);
/*
* If the partition constraints on default partition child imply
@ -1227,7 +1227,7 @@ check_default_partition_contents(Relation parent, Relation default_rel,
(errmsg("updated partition constraint for default partition \"%s\" is implied by existing constraints",
RelationGetRelationName(part_rel))));
heap_close(part_rel, NoLock);
table_close(part_rel, NoLock);
continue;
}
}
@ -1248,7 +1248,7 @@ check_default_partition_contents(Relation parent, Relation default_rel,
RelationGetRelationName(default_rel))));
if (RelationGetRelid(default_rel) != RelationGetRelid(part_rel))
heap_close(part_rel, NoLock);
table_close(part_rel, NoLock);
continue;
}
@ -1296,7 +1296,7 @@ check_default_partition_contents(Relation parent, Relation default_rel,
FreeExecutorState(estate);
if (RelationGetRelid(default_rel) != RelationGetRelid(part_rel))
heap_close(part_rel, NoLock); /* keep the lock until commit */
table_close(part_rel, NoLock); /* keep the lock until commit */
}
}

View File

@ -1883,7 +1883,7 @@ get_database_list(void)
StartTransactionCommand();
(void) GetTransactionSnapshot();
rel = heap_open(DatabaseRelationId, AccessShareLock);
rel = table_open(DatabaseRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
while (HeapTupleIsValid(tup = heap_getnext(scan, ForwardScanDirection)))
@ -1914,7 +1914,7 @@ get_database_list(void)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
CommitTransactionCommand();
@ -2015,7 +2015,7 @@ do_autovacuum(void)
/* The database hash where pgstat keeps shared relations */
shared = pgstat_fetch_stat_dbentry(InvalidOid);
classRel = heap_open(RelationRelationId, AccessShareLock);
classRel = table_open(RelationRelationId, AccessShareLock);
/* create a copy so we can use it after closing pg_class */
pg_class_desc = CreateTupleDescCopy(RelationGetDescr(classRel));
@ -2189,7 +2189,7 @@ do_autovacuum(void)
}
heap_endscan(relScan);
heap_close(classRel, AccessShareLock);
table_close(classRel, AccessShareLock);
/*
* Recheck orphan temporary tables, and if they still seem orphaned, drop

View File

@ -1219,7 +1219,7 @@ pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
&hash_ctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
rel = heap_open(catalogid, AccessShareLock);
rel = table_open(catalogid, AccessShareLock);
snapshot = RegisterSnapshot(GetLatestSnapshot());
scan = heap_beginscan(rel, snapshot, 0, NULL);
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
@ -1236,7 +1236,7 @@ pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
}
heap_endscan(scan);
UnregisterSnapshot(snapshot);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
return htab;
}

View File

@ -135,7 +135,7 @@ get_subscription_list(void)
StartTransactionCommand();
(void) GetTransactionSnapshot();
rel = heap_open(SubscriptionRelationId, AccessShareLock);
rel = table_open(SubscriptionRelationId, AccessShareLock);
scan = heap_beginscan_catalog(rel, 0, NULL);
while (HeapTupleIsValid(tup = heap_getnext(scan, ForwardScanDirection)))
@ -165,7 +165,7 @@ get_subscription_list(void)
}
heap_endscan(scan);
heap_close(rel, AccessShareLock);
table_close(rel, AccessShareLock);
CommitTransactionCommand();

View File

@ -270,7 +270,7 @@ replorigin_create(char *roname)
*/
InitDirtySnapshot(SnapshotDirty);
rel = heap_open(ReplicationOriginRelationId, ExclusiveLock);
rel = table_open(ReplicationOriginRelationId, ExclusiveLock);
for (roident = InvalidOid + 1; roident < PG_UINT16_MAX; roident++)
{
@ -313,7 +313,7 @@ replorigin_create(char *roname)
}
/* now release lock again, */
heap_close(rel, ExclusiveLock);
table_close(rel, ExclusiveLock);
if (tuple == NULL)
ereport(ERROR,
@ -343,7 +343,7 @@ replorigin_drop(RepOriginId roident, bool nowait)
* To interlock against concurrent drops, we hold ExclusiveLock on
* pg_replication_origin throughout this function.
*/
rel = heap_open(ReplicationOriginRelationId, ExclusiveLock);
rel = table_open(ReplicationOriginRelationId, ExclusiveLock);
/*
* First, clean up the slot state info, if there is any matching slot.
@ -419,7 +419,7 @@ restart:
CommandCounterIncrement();
/* now release lock again */
heap_close(rel, ExclusiveLock);
table_close(rel, ExclusiveLock);
}

View File

@ -254,7 +254,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication target relation \"%s.%s\" does not exist",
remoterel->nspname, remoterel->relname)));
entry->localrel = heap_open(relid, NoLock);
entry->localrel = table_open(relid, NoLock);
/* Check for supported relkind. */
CheckSubscriptionRelkind(entry->localrel->rd_rel->relkind,
@ -350,7 +350,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
entry->localreloid = relid;
}
else
entry->localrel = heap_open(entry->localreloid, lockmode);
entry->localrel = table_open(entry->localreloid, lockmode);
if (entry->state != SUBREL_STATE_READY)
entry->state = GetSubscriptionRelState(MySubscription->oid,
@ -367,7 +367,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
void
logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode)
{
heap_close(rel->localrel, lockmode);
table_close(rel->localrel, lockmode);
rel->localrel = NULL;
}

View File

@ -877,7 +877,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
* working and it has to open the relation in RowExclusiveLock
* when remapping remote relation id to local one.
*/
rel = heap_open(MyLogicalRepWorker->relid, RowExclusiveLock);
rel = table_open(MyLogicalRepWorker->relid, RowExclusiveLock);
/*
* Create a temporary slot for the sync process. We do this
@ -915,7 +915,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
errdetail("The error was: %s", res->err)));
walrcv_clear_result(res);
heap_close(rel, NoLock);
table_close(rel, NoLock);
/* Make the copy visible. */
CommandCounterIncrement();

View File

@ -95,7 +95,7 @@ InsertRule(const char *rulname,
/*
* Ready to store new pg_rewrite tuple
*/
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
pg_rewrite_desc = table_open(RewriteRelationId, RowExclusiveLock);
/*
* Check to see if we are replacing an existing tuple
@ -186,7 +186,7 @@ InsertRule(const char *rulname,
/* Post creation hook for new rule */
InvokeObjectPostCreateHook(RewriteRelationId, rewriteObjectId, 0);
heap_close(pg_rewrite_desc, RowExclusiveLock);
table_close(pg_rewrite_desc, RowExclusiveLock);
return rewriteObjectId;
}
@ -255,7 +255,7 @@ DefineQueryRewrite(const char *rulename,
*
* Note that this lock level should match the one used in DefineRule.
*/
event_relation = heap_open(event_relid, AccessExclusiveLock);
event_relation = table_open(event_relid, AccessExclusiveLock);
/*
* Verify relation is of a type that rules can sensibly be applied to.
@ -565,7 +565,7 @@ DefineQueryRewrite(const char *rulename,
HeapTuple classTup;
Form_pg_class classForm;
relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
toastrelid = event_relation->rd_rel->reltoastrelid;
/* drop storage while table still looks like a table */
@ -629,13 +629,13 @@ DefineQueryRewrite(const char *rulename,
CatalogTupleUpdate(relationRelation, &classTup->t_self, classTup);
heap_freetuple(classTup);
heap_close(relationRelation, RowExclusiveLock);
table_close(relationRelation, RowExclusiveLock);
}
ObjectAddressSet(address, RewriteRelationId, ruleId);
/* Close rel, but keep lock till commit... */
heap_close(event_relation, NoLock);
table_close(event_relation, NoLock);
return address;
}
@ -852,7 +852,7 @@ EnableDisableRule(Relation rel, const char *rulename,
/*
* Find the rule tuple to change.
*/
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
pg_rewrite_desc = table_open(RewriteRelationId, RowExclusiveLock);
ruletup = SearchSysCacheCopy2(RULERELNAME,
ObjectIdGetDatum(owningRel),
PointerGetDatum(rulename));
@ -888,7 +888,7 @@ EnableDisableRule(Relation rel, const char *rulename,
InvokeObjectPostAlterHook(RewriteRelationId, ruleform->oid, 0);
heap_freetuple(ruletup);
heap_close(pg_rewrite_desc, RowExclusiveLock);
table_close(pg_rewrite_desc, RowExclusiveLock);
/*
* If we changed anything, broadcast a SI inval message to force each
@ -964,7 +964,7 @@ RenameRewriteRule(RangeVar *relation, const char *oldName,
targetrel = relation_open(relid, NoLock);
/* Prepare to modify pg_rewrite */
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
pg_rewrite_desc = table_open(RewriteRelationId, RowExclusiveLock);
/* Fetch the rule's entry (it had better exist) */
ruletup = SearchSysCacheCopy2(RULERELNAME,
@ -1000,7 +1000,7 @@ RenameRewriteRule(RangeVar *relation, const char *oldName,
CatalogTupleUpdate(pg_rewrite_desc, &ruletup->t_self, ruletup);
heap_freetuple(ruletup);
heap_close(pg_rewrite_desc, RowExclusiveLock);
table_close(pg_rewrite_desc, RowExclusiveLock);
/*
* Invalidate relation's relcache entry so that other backends (and this

View File

@ -180,7 +180,7 @@ AcquireRewriteLocks(Query *parsetree,
else
lockmode = rte->rellockmode;
rel = heap_open(rte->relid, lockmode);
rel = table_open(rte->relid, lockmode);
/*
* While we have the relation open, update the RTE's relkind,
@ -188,7 +188,7 @@ AcquireRewriteLocks(Query *parsetree,
*/
rte->relkind = rel->rd_rel->relkind;
heap_close(rel, NoLock);
table_close(rel, NoLock);
break;
case RTE_JOIN:
@ -1813,7 +1813,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
* We can use NoLock here since either the parser or
* AcquireRewriteLocks should have locked the rel already.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
/*
* Collect the RIR rules that we must apply
@ -1860,7 +1860,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
}
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
/* Recurse into subqueries in WITH */
@ -1904,7 +1904,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
rte->relkind != RELKIND_PARTITIONED_TABLE))
continue;
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
/*
* Fetch any new security quals that must be applied to this RTE.
@ -1979,7 +1979,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
if (hasSubLinks)
parsetree->hasSubLinks = true;
heap_close(rel, NoLock);
table_close(rel, NoLock);
}
return parsetree;
@ -2896,7 +2896,7 @@ rewriteTargetView(Query *parsetree, Relation view)
* already have the right lock!) Since it will become the query target
* relation, RowExclusiveLock is always the right thing.
*/
base_rel = heap_open(base_rte->relid, RowExclusiveLock);
base_rel = table_open(base_rte->relid, RowExclusiveLock);
/*
* While we have the relation open, update the RTE's relkind, just in case
@ -3281,7 +3281,7 @@ rewriteTargetView(Query *parsetree, Relation view)
}
}
heap_close(base_rel, NoLock);
table_close(base_rel, NoLock);
return parsetree;
}
@ -3391,7 +3391,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
* We can use NoLock here since either the parser or
* AcquireRewriteLocks should have locked the rel already.
*/
rt_entry_relation = heap_open(rt_entry->relid, NoLock);
rt_entry_relation = table_open(rt_entry->relid, NoLock);
/*
* Rewrite the targetlist as needed for the command type.
@ -3616,7 +3616,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("INSERT with ON CONFLICT clause cannot be used with table that has INSERT or UPDATE rules")));
heap_close(rt_entry_relation, NoLock);
table_close(rt_entry_relation, NoLock);
}
/*

View File

@ -47,7 +47,7 @@ RemoveRewriteRuleById(Oid ruleOid)
/*
* Open the pg_rewrite relation.
*/
RewriteRelation = heap_open(RewriteRelationId, RowExclusiveLock);
RewriteRelation = table_open(RewriteRelationId, RowExclusiveLock);
/*
* Find the tuple for the target rule.
@ -71,7 +71,7 @@ RemoveRewriteRuleById(Oid ruleOid)
* suffice if it's not an ON SELECT rule.)
*/
eventRelationOid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class;
event_relation = heap_open(eventRelationOid, AccessExclusiveLock);
event_relation = table_open(eventRelationOid, AccessExclusiveLock);
/*
* Now delete the pg_rewrite tuple for the rule
@ -80,7 +80,7 @@ RemoveRewriteRuleById(Oid ruleOid)
systable_endscan(rcscan);
heap_close(RewriteRelation, RowExclusiveLock);
table_close(RewriteRelation, RowExclusiveLock);
/*
* Issue shared-inval notice to force all backends (including me!) to
@ -89,5 +89,5 @@ RemoveRewriteRuleById(Oid ruleOid)
CacheInvalidateRelcache(event_relation);
/* Close rel, but keep lock till commit... */
heap_close(event_relation, NoLock);
table_close(event_relation, NoLock);
}

View File

@ -61,7 +61,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules)
/*
* Find the tuple to update in pg_class, using syscache for the lookup.
*/
relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
relationRelation = table_open(RelationRelationId, RowExclusiveLock);
tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for relation %u", relationId);
@ -81,7 +81,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules)
}
heap_freetuple(tuple);
heap_close(relationRelation, RowExclusiveLock);
table_close(relationRelation, RowExclusiveLock);
}
/*

View File

@ -162,7 +162,7 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
* for example in UPDATE t1 ... FROM t2 we need to apply t1's UPDATE
* policies and t2's SELECT policies.
*/
rel = heap_open(rte->relid, NoLock);
rel = table_open(rte->relid, NoLock);
commandType = rt_index == root->resultRelation ?
root->commandType : CMD_SELECT;
@ -379,7 +379,7 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index,
}
}
heap_close(rel, NoLock);
table_close(rel, NoLock);
/*
* Mark this query as having row security, so plancache can invalidate it

View File

@ -79,7 +79,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
ALLOCSET_DEFAULT_SIZES);
oldcxt = MemoryContextSwitchTo(cxt);
pg_stext = heap_open(StatisticExtRelationId, RowExclusiveLock);
pg_stext = table_open(StatisticExtRelationId, RowExclusiveLock);
stats = fetch_statentries_for_relation(pg_stext, RelationGetRelid(onerel));
foreach(lc, stats)
@ -130,7 +130,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
statext_store(pg_stext, stat->statOid, ndistinct, dependencies, stats);
}
heap_close(pg_stext, RowExclusiveLock);
table_close(pg_stext, RowExclusiveLock);
MemoryContextSwitchTo(oldcxt);
MemoryContextDelete(cxt);

View File

@ -84,7 +84,7 @@ open_lo_relation(void)
/* Use RowExclusiveLock since we might either read or write */
if (lo_heap_r == NULL)
lo_heap_r = heap_open(LargeObjectRelationId, RowExclusiveLock);
lo_heap_r = table_open(LargeObjectRelationId, RowExclusiveLock);
if (lo_index_r == NULL)
lo_index_r = index_open(LargeObjectLOidPNIndexId, RowExclusiveLock);
@ -113,7 +113,7 @@ close_lo_relation(bool isCommit)
if (lo_index_r)
index_close(lo_index_r, NoLock);
if (lo_heap_r)
heap_close(lo_heap_r, NoLock);
table_close(lo_heap_r, NoLock);
CurrentResourceOwner = currentOwner;
}
@ -141,8 +141,8 @@ myLargeObjectExists(Oid loid, Snapshot snapshot)
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(loid));
pg_lo_meta = heap_open(LargeObjectMetadataRelationId,
AccessShareLock);
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
AccessShareLock);
sd = systable_beginscan(pg_lo_meta,
LargeObjectMetadataOidIndexId, true,
@ -154,7 +154,7 @@ myLargeObjectExists(Oid loid, Snapshot snapshot)
systable_endscan(sd);
heap_close(pg_lo_meta, AccessShareLock);
table_close(pg_lo_meta, AccessShareLock);
return retval;
}

Some files were not shown because too many files have changed in this diff Show More