1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Replace uses of heap_open et al with the corresponding table_* function.

Author: Andres Freund
Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
This commit is contained in:
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

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