mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Replace uses of heap_open et al with the corresponding table_* function.
Author: Andres Freund Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user