diff options
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r-- | src/backend/utils/adt/enum.c | 8 | ||||
-rw-r--r-- | src/backend/utils/adt/misc.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 34 | ||||
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 24 | ||||
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/tid.c | 10 | ||||
-rw-r--r-- | src/backend/utils/adt/xml.c | 16 |
7 files changed, 50 insertions, 50 deletions
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c index de6a08ba555..3402ff860d3 100644 --- a/src/backend/utils/adt/enum.c +++ b/src/backend/utils/adt/enum.c @@ -403,7 +403,7 @@ enum_endpoint(Oid enumtypoid, ScanDirection direction) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(enumtypoid)); - enum_rel = heap_open(EnumRelationId, AccessShareLock); + enum_rel = table_open(EnumRelationId, AccessShareLock); enum_idx = index_open(EnumTypIdSortOrderIndexId, AccessShareLock); enum_scan = systable_beginscan_ordered(enum_rel, enum_idx, NULL, 1, &skey); @@ -423,7 +423,7 @@ enum_endpoint(Oid enumtypoid, ScanDirection direction) systable_endscan_ordered(enum_scan); index_close(enum_idx, AccessShareLock); - heap_close(enum_rel, AccessShareLock); + table_close(enum_rel, AccessShareLock); return minmax; } @@ -562,7 +562,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(enumtypoid)); - enum_rel = heap_open(EnumRelationId, AccessShareLock); + enum_rel = table_open(EnumRelationId, AccessShareLock); enum_idx = index_open(EnumTypIdSortOrderIndexId, AccessShareLock); enum_scan = systable_beginscan_ordered(enum_rel, enum_idx, NULL, 1, &skey); @@ -598,7 +598,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper) systable_endscan_ordered(enum_scan); index_close(enum_idx, AccessShareLock); - heap_close(enum_rel, AccessShareLock); + table_close(enum_rel, AccessShareLock); /* and build the result array */ /* note this hardwires some details about the representation of Oid */ diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 91de57e5ceb..d330a88e3c1 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -822,9 +822,9 @@ pg_get_replica_identity_index(PG_FUNCTION_ARGS) Oid idxoid; Relation rel; - rel = heap_open(reloid, AccessShareLock); + rel = table_open(reloid, AccessShareLock); idxoid = RelationGetReplicaIndex(rel); - heap_close(rel, AccessShareLock); + table_close(rel, AccessShareLock); if (OidIsValid(idxoid)) PG_RETURN_OID(idxoid); diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 3c18d8695c8..93399f811a5 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -301,7 +301,7 @@ RI_FKey_check(TriggerData *trigdata) * SELECT FOR KEY SHARE will get on it. */ fk_rel = trigdata->tg_relation; - pk_rel = heap_open(riinfo->pk_relid, RowShareLock); + pk_rel = table_open(riinfo->pk_relid, RowShareLock); if (riinfo->confmatchtype == FKCONSTR_MATCH_PARTIAL) ereport(ERROR, @@ -316,7 +316,7 @@ RI_FKey_check(TriggerData *trigdata) * No further check needed - an all-NULL key passes every type of * foreign key constraint. */ - heap_close(pk_rel, RowShareLock); + table_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); case RI_KEYS_SOME_NULL: @@ -341,7 +341,7 @@ RI_FKey_check(TriggerData *trigdata) errdetail("MATCH FULL does not allow mixing of null and nonnull key values."), errtableconstraint(fk_rel, NameStr(riinfo->conname)))); - heap_close(pk_rel, RowShareLock); + table_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); case FKCONSTR_MATCH_SIMPLE: @@ -350,7 +350,7 @@ RI_FKey_check(TriggerData *trigdata) * MATCH SIMPLE - if ANY column is null, the key passes * the constraint. */ - heap_close(pk_rel, RowShareLock); + table_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); case FKCONSTR_MATCH_PARTIAL: @@ -364,7 +364,7 @@ RI_FKey_check(TriggerData *trigdata) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("MATCH PARTIAL not yet implemented"))); - heap_close(pk_rel, RowShareLock); + table_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); default: @@ -445,7 +445,7 @@ RI_FKey_check(TriggerData *trigdata) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(pk_rel, RowShareLock); + table_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); } @@ -707,7 +707,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action) * fk_rel is opened in RowShareLock mode since that's what our eventual * SELECT FOR KEY SHARE will get on it. */ - fk_rel = heap_open(riinfo->fk_relid, RowShareLock); + fk_rel = table_open(riinfo->fk_relid, RowShareLock); pk_rel = trigdata->tg_relation; old_row = trigdata->tg_trigtuple; @@ -735,7 +735,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action) if (is_no_action && ri_Check_Pk_Match(pk_rel, fk_rel, old_row, riinfo)) { - heap_close(fk_rel, RowShareLock); + table_close(fk_rel, RowShareLock); return PointerGetDatum(NULL); } @@ -808,7 +808,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(fk_rel, RowShareLock); + table_close(fk_rel, RowShareLock); return PointerGetDatum(NULL); @@ -867,7 +867,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) * fk_rel is opened in RowExclusiveLock mode since that's what our * eventual DELETE will get on it. */ - fk_rel = heap_open(riinfo->fk_relid, RowExclusiveLock); + fk_rel = table_open(riinfo->fk_relid, RowExclusiveLock); pk_rel = trigdata->tg_relation; old_row = trigdata->tg_trigtuple; @@ -948,7 +948,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(fk_rel, RowExclusiveLock); + table_close(fk_rel, RowExclusiveLock); return PointerGetDatum(NULL); @@ -1010,7 +1010,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) * fk_rel is opened in RowExclusiveLock mode since that's what our * eventual UPDATE will get on it. */ - fk_rel = heap_open(riinfo->fk_relid, RowExclusiveLock); + fk_rel = table_open(riinfo->fk_relid, RowExclusiveLock); pk_rel = trigdata->tg_relation; new_row = trigdata->tg_newtuple; old_row = trigdata->tg_trigtuple; @@ -1104,7 +1104,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(fk_rel, RowExclusiveLock); + table_close(fk_rel, RowExclusiveLock); return PointerGetDatum(NULL); @@ -1197,7 +1197,7 @@ ri_setnull(TriggerData *trigdata) * fk_rel is opened in RowExclusiveLock mode since that's what our * eventual UPDATE will get on it. */ - fk_rel = heap_open(riinfo->fk_relid, RowExclusiveLock); + fk_rel = table_open(riinfo->fk_relid, RowExclusiveLock); pk_rel = trigdata->tg_relation; old_row = trigdata->tg_trigtuple; @@ -1291,7 +1291,7 @@ ri_setnull(TriggerData *trigdata) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(fk_rel, RowExclusiveLock); + table_close(fk_rel, RowExclusiveLock); return PointerGetDatum(NULL); @@ -1383,7 +1383,7 @@ ri_setdefault(TriggerData *trigdata) * fk_rel is opened in RowExclusiveLock mode since that's what our * eventual UPDATE will get on it. */ - fk_rel = heap_open(riinfo->fk_relid, RowExclusiveLock); + fk_rel = table_open(riinfo->fk_relid, RowExclusiveLock); pk_rel = trigdata->tg_relation; old_row = trigdata->tg_trigtuple; @@ -1478,7 +1478,7 @@ ri_setdefault(TriggerData *trigdata) if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed"); - heap_close(fk_rel, RowExclusiveLock); + table_close(fk_rel, RowExclusiveLock); /* * If we just deleted or updated the PK row whose key was equal to diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 97eeabc8f04..2461d7f35ee 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -842,7 +842,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) /* * Fetch the pg_trigger tuple by the Oid of the trigger */ - tgrel = heap_open(TriggerRelationId, AccessShareLock); + tgrel = table_open(TriggerRelationId, AccessShareLock); ScanKeyInit(&skey[0], Anum_pg_trigger_oid, @@ -857,7 +857,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) if (!HeapTupleIsValid(ht_trig)) { systable_endscan(tgscan); - heap_close(tgrel, AccessShareLock); + table_close(tgrel, AccessShareLock); return NULL; } @@ -1078,7 +1078,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) /* Clean up */ systable_endscan(tgscan); - heap_close(tgrel, AccessShareLock); + table_close(tgrel, AccessShareLock); return buf.data; } @@ -1882,7 +1882,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, SysScanDesc scandesc; ScanKeyData scankey[1]; Snapshot snapshot = RegisterSnapshot(GetTransactionSnapshot()); - Relation relation = heap_open(ConstraintRelationId, AccessShareLock); + Relation relation = table_open(ConstraintRelationId, AccessShareLock); ScanKeyInit(&scankey[0], Anum_pg_constraint_oid, @@ -1909,7 +1909,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, if (missing_ok) { systable_endscan(scandesc); - heap_close(relation, AccessShareLock); + table_close(relation, AccessShareLock); return NULL; } elog(ERROR, "could not find tuple for constraint %u", constraintId); @@ -2260,7 +2260,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, /* Cleanup */ systable_endscan(scandesc); - heap_close(relation, AccessShareLock); + table_close(relation, AccessShareLock); return buf.data; } @@ -2471,7 +2471,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS) column, tablerv->relname))); /* Search the dependency table for the dependent sequence */ - depRel = heap_open(DependRelationId, AccessShareLock); + depRel = table_open(DependRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_depend_refclassid, @@ -2510,7 +2510,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS) } systable_endscan(scan); - heap_close(depRel, AccessShareLock); + table_close(depRel, AccessShareLock); if (OidIsValid(sequenceId)) { @@ -4790,7 +4790,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, if (ev_action != NULL) actions = (List *) stringToNode(ev_action); - ev_relation = heap_open(ev_class, AccessShareLock); + ev_relation = table_open(ev_class, AccessShareLock); /* * Build the rules definition text @@ -4924,7 +4924,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, appendStringInfoChar(buf, ';'); } - heap_close(ev_relation, AccessShareLock); + table_close(ev_relation, AccessShareLock); } @@ -4991,13 +4991,13 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, return; } - ev_relation = heap_open(ev_class, AccessShareLock); + ev_relation = table_open(ev_class, AccessShareLock); get_query_def(query, buf, NIL, RelationGetDescr(ev_relation), prettyFlags, wrapColumn, 0); appendStringInfoChar(buf, ';'); - heap_close(ev_relation, AccessShareLock); + table_close(ev_relation, AccessShareLock); } diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 71cfe6499ca..bdb7d708279 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -5547,7 +5547,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, * already have at least AccessShareLock on the table, but not * necessarily on the index. */ - heapRel = heap_open(rte->relid, NoLock); + heapRel = table_open(rte->relid, NoLock); indexRel = index_open(index->indexoid, AccessShareLock); /* extract index key information from the index's pg_index info */ @@ -5668,7 +5668,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, ExecDropSingleTupleTableSlot(slot); index_close(indexRel, AccessShareLock); - heap_close(heapRel, NoLock); + table_close(heapRel, NoLock); MemoryContextSwitchTo(oldcontext); FreeExecutorState(estate); diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index b016ab3c6c9..8097097f7bb 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -337,7 +337,7 @@ currtid_for_view(Relation viewrel, ItemPointer tid) rte = rt_fetch(var->varno, query->rtable); if (rte) { - heap_close(viewrel, AccessShareLock); + table_close(viewrel, AccessShareLock); return DirectFunctionCall2(currtid_byreloid, ObjectIdGetDatum(rte->relid), PointerGetDatum(tid)); } } @@ -366,7 +366,7 @@ currtid_byreloid(PG_FUNCTION_ARGS) PG_RETURN_ITEMPOINTER(result); } - rel = heap_open(reloid, AccessShareLock); + rel = table_open(reloid, AccessShareLock); aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(), ACL_SELECT); @@ -383,7 +383,7 @@ currtid_byreloid(PG_FUNCTION_ARGS) heap_get_latest_tid(rel, snapshot, result); UnregisterSnapshot(snapshot); - heap_close(rel, AccessShareLock); + table_close(rel, AccessShareLock); PG_RETURN_ITEMPOINTER(result); } @@ -400,7 +400,7 @@ currtid_byrelname(PG_FUNCTION_ARGS) Snapshot snapshot; relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname)); - rel = heap_openrv(relrv, AccessShareLock); + rel = table_openrv(relrv, AccessShareLock); aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(), ACL_SELECT); @@ -418,7 +418,7 @@ currtid_byrelname(PG_FUNCTION_ARGS) heap_get_latest_tid(rel, snapshot, result); UnregisterSnapshot(snapshot); - heap_close(rel, AccessShareLock); + table_close(rel, AccessShareLock); PG_RETURN_ITEMPOINTER(result); } diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 7c04586ad5e..11a5d706fd8 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -2584,10 +2584,10 @@ table_to_xmlschema(PG_FUNCTION_ARGS) const char *result; Relation rel; - rel = heap_open(relid, AccessShareLock); + rel = table_open(relid, AccessShareLock); result = map_sql_table_to_xmlschema(rel->rd_att, relid, nulls, tableforest, targetns); - heap_close(rel, NoLock); + table_close(rel, NoLock); PG_RETURN_XML_P(cstring_to_xmltype(result)); } @@ -2658,10 +2658,10 @@ table_to_xml_and_xmlschema(PG_FUNCTION_ARGS) Relation rel; const char *xmlschema; - rel = heap_open(relid, AccessShareLock); + rel = table_open(relid, AccessShareLock); xmlschema = map_sql_table_to_xmlschema(rel->rd_att, relid, nulls, tableforest, targetns); - heap_close(rel, NoLock); + table_close(rel, NoLock); PG_RETURN_XML_P(stringinfo_to_xmltype(table_to_xml_internal(relid, xmlschema, nulls, tableforest, @@ -2819,9 +2819,9 @@ schema_to_xmlschema_internal(const char *schemaname, bool nulls, { Relation rel; - rel = heap_open(lfirst_oid(cell), AccessShareLock); + rel = table_open(lfirst_oid(cell), AccessShareLock); tupdesc_list = lappend(tupdesc_list, CreateTupleDescCopy(rel->rd_att)); - heap_close(rel, NoLock); + table_close(rel, NoLock); } appendStringInfoString(result, @@ -2959,9 +2959,9 @@ database_to_xmlschema_internal(bool nulls, bool tableforest, { Relation rel; - rel = heap_open(lfirst_oid(cell), AccessShareLock); + rel = table_open(lfirst_oid(cell), AccessShareLock); tupdesc_list = lappend(tupdesc_list, CreateTupleDescCopy(rel->rd_att)); - heap_close(rel, NoLock); + table_close(rel, NoLock); } appendStringInfoString(result, |