Replace uses of heap_open et al with the corresponding table_* function.
authorAndres Freund <andres@anarazel.de>
Mon, 21 Jan 2019 18:32:19 +0000 (10:32 -0800)
committerAndres Freund <andres@anarazel.de>
Mon, 21 Jan 2019 18:51:37 +0000 (10:51 -0800)
Author: Andres Freund
Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de

114 files changed:
contrib/amcheck/verify_nbtree.c
contrib/dblink/dblink.c
contrib/file_fdw/file_fdw.c
contrib/pgrowlocks/pgrowlocks.c
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/postgres_fdw.c
contrib/sepgsql/database.c
contrib/sepgsql/label.c
contrib/sepgsql/proc.c
contrib/sepgsql/relation.c
contrib/sepgsql/schema.c
src/backend/access/brin/brin.c
src/backend/access/heap/heapam.c
src/backend/access/heap/tuptoaster.c
src/backend/access/nbtree/nbtsort.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/aclchk.c
src/backend/catalog/catalog.c
src/backend/catalog/dependency.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/objectaddress.c
src/backend/catalog/partition.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_collation.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_conversion.c
src/backend/catalog/pg_db_role_setting.c
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_enum.c
src/backend/catalog/pg_inherits.c
src/backend/catalog/pg_largeobject.c
src/backend/catalog/pg_namespace.c
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_publication.c
src/backend/catalog/pg_range.c
src/backend/catalog/pg_shdepend.c
src/backend/catalog/pg_subscription.c
src/backend/catalog/pg_type.c
src/backend/catalog/toasting.c
src/backend/commands/alter.c
src/backend/commands/amcmds.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/collationcmds.c
src/backend/commands/comment.c
src/backend/commands/copy.c
src/backend/commands/createas.c
src/backend/commands/dbcommands.c
src/backend/commands/dropcmds.c
src/backend/commands/event_trigger.c
src/backend/commands/extension.c
src/backend/commands/foreigncmds.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/lockcmds.c
src/backend/commands/matview.c
src/backend/commands/opclasscmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/policy.c
src/backend/commands/proclang.c
src/backend/commands/publicationcmds.c
src/backend/commands/schemacmds.c
src/backend/commands/seclabel.c
src/backend/commands/sequence.c
src/backend/commands/statscmds.c
src/backend/commands/subscriptioncmds.c
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/commands/trigger.c
src/backend/commands/tsearchcmds.c
src/backend/commands/typecmds.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/executor/execMain.c
src/backend/executor/execPartition.c
src/backend/executor/execUtils.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/util/inherit.c
src/backend/optimizer/util/plancat.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_node.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_utilcmd.c
src/backend/partitioning/partbounds.c
src/backend/postmaster/autovacuum.c
src/backend/postmaster/pgstat.c
src/backend/replication/logical/launcher.c
src/backend/replication/logical/origin.c
src/backend/replication/logical/relation.c
src/backend/replication/logical/tablesync.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteRemove.c
src/backend/rewrite/rewriteSupport.c
src/backend/rewrite/rowsecurity.c
src/backend/statistics/extended_stats.c
src/backend/storage/large_object/inv_api.c
src/backend/utils/adt/enum.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/tid.c
src/backend/utils/adt/xml.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relfilenodemap.c
src/backend/utils/cache/ts_cache.c
src/backend/utils/cache/typcache.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/queryenvironment.c

index 055bfa05707433579b9c6953a42719ae57a778a2..1c7466c81583317a72112d38330bcc23a7280054 100644 (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);
 }
 
 /*
index 5092aba3e42793533844f37e0bd8e5a38ade521b..6f5f0a7fa57631dc1e6d074cfa94da745ae6661d 100644 (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);
index 9b73696e2a7c4fd0f3b1404d7c1637ce05e5cb91..e7db83d3fbb38135165d2ca143699b5674d5e3c4 100644 (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)
index fffee6e27e05a939e3677d6dba123a77e1189ea5..2cb3d1ca3bc8f4dd7052c73e787b1d985e787622 100644 (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);
 }
index 20982daef68745820e887305496402a8c41e4ad5..f368d4b31fbc62199dd3b50e1f12ab5de6789658 100644 (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
index 36ae10db11556ebacf9be7bd5a0e92dfec122814..d85a83abe98ae8573d833f0ba76861bcdab12a73 100644 (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;
 }
 
index 837728e07b0a6a0a1566ec5e07aafe082ee53a65..b2419f0d81123b76d3f444ed5aad9ca99e238fa8 100644 (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
index 19bbee328e344ed381b89de4c47a283ce67a1e0a..d7f5d20d63d0d064c99a0287b97ed63d87e56c6b 100644 (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);
 }
 
 /*
index 74487eda03af9dcefafb7a12bf9358ab3aadc2e7..a4038dfd1b828482b174fda4485a516770d80434 100644 (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);
 }
 
 /*
index 12cfebecc64f1c0186d8325ed7582a48e8b7ddf9..6842d2a42b764f7379876b6adcf41c1e206c9cec 100644 (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);
 }
index 752cd56a86a3cf78f14979653a804764e23bbca2..668d65e70f543c1b622593653b385ebd3c597866 100644 (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
index 34f82d46821b242ffb40426efc6d813ce92a3d99..467d91e681820917e232f423187532b7a3694f9e 100644 (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;
 
index 6c33aefd8553b460cdbfeea887169a283dfb1595..dc2ff89d270846c861d763aabaf0166decfc8dd8 100644 (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);
    }
 }
 
index 0ffc5392a6d929d34fefb0e34b05d1dc29c5342d..6763fb920c2c0f326009ad255afc663b479ba00a 100644 (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;
 }
index 5cc3cf57e22ce6bbc7299431f9ca6f10779335c7..dc398e11867d172d3fcc6ec4cff175f1c34885be 100644 (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);
 }
 
 /*
index 63bb134949682af1818846bf5a9ed68f8e35cca3..bec0a93e43829c17a438b42d08d1b33a94ff80ff 100644 (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);
    }
 }
index b4f3bd4999385d0b775a42e2a0b6eef2bf3bb968..41bac7227a6ba556de57db8c51ca7a57d3b51848 100644 (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);
 }
index 48303926e487969dc1053603daa34098fb7d952b..a9d2621a7eed553974877bfd639036265508ac77 100644 (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;
index 4988213c0d794d9ee6dc90af748a10cda5dbc4fc..9c3b781d8e439fcc743989cc5d6d014fbe60837c 100644 (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);
 }
index 07e720df2fc2a76f88555275f8895286b74495ac..c11bbd19c71dbdfa72a5ef90c0574d51be01bcec 100644 (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
index 8701e3a791cf50d6d68f515b66356ab07c73c0f2..b6d472335fe8a568521c69cb5e9fa5dcf39f7d0e 100644 (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);
 
index d68e28c9b432b212ba18bd3b898c0696a07f6cfb..c0202d619aee941daf2d5082fa1bb9c4bcfdbbba 100644 (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;
 
index 83ec22cb0fdebd5b73c39bb09accae782d16c38c..62d1ec60ba57aef84eb4680ccb0fb60babc7af63 100644 (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);
 }
 
 /*
index fe953c95ae59ac741348faea8570141c39c1773e..cc3806e85d571178ce330b1d50a8f66c0dca2716 100644 (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
index 57ce7d7205c8d391e3ad38f9e1773f59b2414284..ea6777f902e6f7f6cfc4c517bdd2157f8428d5b0 100644 (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);
 }
index 52fe8e6731015413a5a169a9ab1ebc230846c1eb..620c7857c9f9c8fbb2ada15b2aebffb24156c941 100644 (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;
 }
index 9ca81dc86066d55cdb3c068c00882259593ac2a7..4e6399a9e63a3de2553d14647b0f050c39a5e480 100644 (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);
 }
 
 /*
index efcc59f3c08a4ad4afad0e56b6ffb603f443a964..3a634de8dcea71d5a3ace13009f53e43068d5ec6 100644 (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);
 }
 
 /*
index 6a46d2e5b1838ca2b07ecb449e1b627b2a39260d..5d34937ea8f1e0bfe7b0de34c0e30104b5437126 100644 (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;
 }
index 77b1b9fb27f4bf2394b3b7bb267a5865407f1a66..0cdec168c3b86ada70d73c4d846abf01b0f6a2d9 100644 (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);
 }
 
 
index d07bbba34d39b3b973d0090fe3a0797f2f86d85c..d3f98b320769dfdbae6cf15fcbfe6661b12fbbe2 100644 (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;
 }
index 1d068ca0bebe5d025503d13f183a6db0e309dd2b..f6384446e399560a68e77da8ca4c72e49954fb7e 100644 (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;
 }
index 763a0b75ab17285cab166962ebdae329ad85ba59..81958813b182b4f4e862bf3922260638c846d759 100644 (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;
index dbe89c51710e213ca0332614d99f7b1e9aa6e55a..0f9a12b35c27f56e7235ff1d998958f80be106f0 100644 (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);
 }
 
 /*
index 32887e548b86c09dab19b50c1f955f50b3b64728..db780616e6212726ce9f9edeaaffb7da49b9138d 100644 (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))
index 72a4d2b17fe4e44c610dac3e9be16d7fadcfdbf0..96f92750728e59b5da30e7bb6248bcf07ece9476 100644 (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;
 }
index dc83727d9dc97a98ce8100d77847225a5f6617cc..08fb13bc4747fb8b49f6b9d9d208b715c00b8d7c 100644 (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);
 }
index a8db901bcb8ffef03a2e5d776f6920d90418b8a8..064bafb80021e97f25f340da4495712081c0ea20 100644 (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);
 }
index 24548f777b1d90023c6a4fa9f1d182ed4395f94e..935d7670e429afff4aaaf619df22258c564c3511 100644 (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;
 }
index b14beae9e137fb04388f6605aafbde9d9fad0f4a..2a51501d8d9dbc62677fa267e2945a846845ab0e 100644 (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,
index 827e1c82dd6c873dbdd71f4c489244c4536a6f97..77be19175a6e9f734ba175c06c9c9370bde6027b 100644 (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
index 08c2cf3569f50ba3560c226c057ed321de5af270..848eee0123e2e0e4c1f507e4c46bb08bdc9e6f00 100644 (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;
            }
index a720d14df066e499308f3cd33d52e16db22c7c81..c84507b5d039243f2435323b01a39817247f3463 100644 (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);
 }
 
 /*
index ac40bd793d14afe009aae068f4a594a7d37e5d6f..83625d10e7556be87b0bf05712e3089a0c68dd4b 100644 (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);
 }
 
 /*
index a89210808b307b1bd697745b3250bc2ed58d0e56..99e25cd50fb945fa21c3a016c804daacfd1f546c 100644 (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,
index d9a3088ac27ac9ea4e298292765f59fee5fb2343..ed3f1c12e57e1189f84abc6314bf2c3d62bf2402 100644 (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;
 }
index d4714a5c1f82db1c531e06df35020c511949a3ea..98b4b3e7b16984049f791731cf0e03161491d107 100644 (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;
 }
index 05d53f96f68d06ebe8318a4c141f992b6b81ae3e..c410e0a0dd6df1e047d409556c2ba95eb1c5c355 100644 (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));
 }
 
 /*
index 5947996d673f6547828483062af432451c77a29d..2bc8f928eab2c61fcad4cbfbebdd932668f109b8 100644 (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;
 }
 
index 1208fdf33ff205ed116fcb4ae216dd8ba2a7434f..6de8f98e7278a10c2f01e1bd00d9cdba41ff4544 100644 (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,
index d878bd47d9ba5a269ac32a6d9d5d32810cd45a87..f26a2f4779a33b4d663ada8692a8511289b301dc 100644 (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);
    }
index 9735fde971141e673d04f9071dc93792af0ce132..5b4502bd7fc88247b080d44f4bed51d966247335 100644 (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);
                        }
                    }
 
index 63a67e377a5053b65fba96b8a6d1c6177bc45169..36dad4ba94a1277c9437daff4ce3bdb48d450efb 100644 (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
index 03976f0454f119283e1a1739b77818426392addd..413ce3fcb66d64796605afd9f87ec816bfdbeaed 100644 (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);
 }
 
 /*
index 9a8d388909f771e5561d35cb3f7fc43bc6033de6..dbe96f8d7a9f175e3ad41af82a24f1e05a5b6b50 100644 (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);
 }
 
 
index 1959e8a82eed98e5704ed6d16b198790c44f3c9d..aa5c6ca872b9c74f2e1bb1fc72c750e2bc89be0b 100644 (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();
index 1dbda8f8ee317db9ef967f98b33d3a7920746cba..f4da564e012b8e638467ad27ff1c6a25ddc904c8 100644 (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);
 }
 
 /*
index 416051a8e30addbfe6988a463aff4f1c03d4f40d..5a47be4b33c51f49193d6842af207cb94c44d3a4 100644 (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);
index e1b1a7e3169a6c659228c6137adc9e59b6cc96f8..950f3bc48621a65b619b164ba9f1acb595f1057c 100644 (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);
 }
 
 /*
index 9733d6c7bda956a60c31e50cfae0a58afcd872e3..7b98e4b910cf7e4dcb92cf1b13c746a476552053 100644 (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;
 }
index 8465de0e1ddac2e8e4554830312f53f09d076958..6a85e1436915962a2627f732a34884317bdf10e0 100644 (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;
 }
index 572a5d5bdea6ab1eaa3d4aa33d2aa607212ee0ee..52eb37d60af07909e1166ef9a5ef59f92f937ad8 100644 (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);
 }
 
 /*
index e431e58f0e614d74b934cda7e562341069352f9e..eb9a093ea035e9e60005f3d668769b05a3fe6fe0 100644 (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);
 }
index 8367261fbe8cce85f1447c2eb9cc8bbd5fe00202..6cf94a3140b45d45ab07e978b6da8fc099f85826 100644 (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;
 }
index 1e31dc1f6783c06c8d6f6a3d00b88e898ec39720..645a0bf16b3174e15d404bf3a31e7fea11f3fad1 100644 (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
index 5554e883d801f653c2e7c17f55cc021b7d7e0908..574b46a28123947324aa6ea02e76aa25151f5bf4 100644 (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);
 }
 
 /*
index 970fdb712d6bb2ae59a73ae088e17c140d78a23a..50762e2d51ad8ac888eebe0f9aab408b82ebc577 100644 (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);
 }
 
 /*
index bd0f4cd1a15c0dd46594817447f341f983afe4ee..a60a15193a434a024743aa4a2ad2693a23034d85 100644 (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);
 }
 
 /*
index 1a1ac698e54552906a998e5eb261d96fa1bcfd03..ffb86ab139a25003ed9031be4e7b79ff7c25deb5 100644 (file)
@@ -833,7 +833,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
                    defaultRel = NULL;
 
        /* Already have strong enough lock on the parent */
-       parent = heap_open(parentId, NoLock);
+       parent = table_open(parentId, NoLock);
 
        /*
         * We are going to try to validate the partition bound specification
@@ -867,7 +867,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
        defaultPartOid =
            get_default_oid_from_partdesc(RelationGetPartitionDesc(parent));
        if (OidIsValid(defaultPartOid))
-           defaultRel = heap_open(defaultPartOid, AccessExclusiveLock);
+           defaultRel = table_open(defaultPartOid, AccessExclusiveLock);
 
        /* Transform the bound values */
        pstate = make_parsestate(NULL);
@@ -892,13 +892,13 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
        {
            check_default_partition_contents(parent, defaultRel, bound);
            /* Keep the lock until commit. */
-           heap_close(defaultRel, NoLock);
+           table_close(defaultRel, NoLock);
        }
 
        /* Update the pg_class entry. */
        StorePartitionBound(rel, parent, bound);
 
-       heap_close(parent, NoLock);
+       table_close(parent, NoLock);
    }
 
    /* Store inheritance information for new rel. */
@@ -965,7 +965,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
        ListCell   *cell;
 
        /* Already have strong enough lock on the parent */
-       parent = heap_open(parentId, NoLock);
+       parent = table_open(parentId, NoLock);
        idxlist = RelationGetIndexList(parent);
 
        /*
@@ -1010,7 +1010,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
         */
        CloneForeignKeyConstraints(parentId, relationId, NULL);
 
-       heap_close(parent, NoLock);
+       table_close(parent, NoLock);
    }
 
    /*
@@ -1384,12 +1384,12 @@ ExecuteTruncate(TruncateStmt *stmt)
                                           NULL);
 
        /* open the relation, we already hold a lock on it */
-       rel = heap_open(myrelid, NoLock);
+       rel = table_open(myrelid, NoLock);
 
        /* don't throw error for "TRUNCATE foo, foo" */
        if (list_member_oid(relids, myrelid))
        {
-           heap_close(rel, lockmode);
+           table_close(rel, lockmode);
            continue;
        }
 
@@ -1420,7 +1420,7 @@ ExecuteTruncate(TruncateStmt *stmt)
                    continue;
 
                /* find_all_inheritors already got lock */
-               rel = heap_open(childrelid, NoLock);
+               rel = table_open(childrelid, NoLock);
 
                /*
                 * It is possible that the parent table has children that are
@@ -1433,7 +1433,7 @@ ExecuteTruncate(TruncateStmt *stmt)
                 */
                if (RELATION_IS_OTHER_TEMP(rel))
                {
-                   heap_close(rel, lockmode);
+                   table_close(rel, lockmode);
                    continue;
                }
 
@@ -1462,7 +1462,7 @@ ExecuteTruncate(TruncateStmt *stmt)
    {
        Relation    rel = (Relation) lfirst(cell);
 
-       heap_close(rel, NoLock);
+       table_close(rel, NoLock);
    }
 }
 
@@ -1518,7 +1518,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
                Oid         relid = lfirst_oid(cell);
                Relation    rel;
 
-               rel = heap_open(relid, AccessExclusiveLock);
+               rel = table_open(relid, AccessExclusiveLock);
                ereport(NOTICE,
                        (errmsg("truncate cascades to table \"%s\"",
                                RelationGetRelationName(rel))));
@@ -1687,7 +1687,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
                                          RecentXmin, minmulti);
                if (toastrel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED)
                    heap_create_init_fork(toastrel);
-               heap_close(toastrel, NoLock);
+               table_close(toastrel, NoLock);
            }
 
            /*
@@ -1771,7 +1771,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
    {
        Relation    rel = (Relation) lfirst(cell);
 
-       heap_close(rel, NoLock);
+       table_close(rel, NoLock);
    }
 }
 
@@ -2026,7 +2026,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
        AttrNumber  parent_attno;
 
        /* caller already got lock */
-       relation = heap_open(parent, NoLock);
+       relation = table_open(parent, NoLock);
 
        /*
         * Check for active uses of the parent partitioned table in the
@@ -2317,7 +2317,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
         * That will prevent someone else from deleting or ALTERing the parent
         * before the child is committed.
         */
-       heap_close(relation, NoLock);
+       table_close(relation, NoLock);
    }
 
    /*
@@ -2595,7 +2595,7 @@ StoreCatalogInheritance(Oid relationId, List *supers,
     * and then entered into pg_ipl.  Since that catalog doesn't exist
     * anymore, there's no need to look for indirect ancestors.)
     */
-   relation = heap_open(InheritsRelationId, RowExclusiveLock);
+   relation = table_open(InheritsRelationId, RowExclusiveLock);
 
    seqNumber = 1;
    foreach(entry, supers)
@@ -2607,7 +2607,7 @@ StoreCatalogInheritance(Oid relationId, List *supers,
        seqNumber++;
    }
 
-   heap_close(relation, RowExclusiveLock);
+   table_close(relation, RowExclusiveLock);
 }
 
 /*
@@ -2701,7 +2701,7 @@ SetRelationHasSubclass(Oid relationId, bool relhassubclass)
    /*
     * Fetch a modifiable copy of the tuple, modify it, update pg_class.
     */
-   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);
@@ -2719,7 +2719,7 @@ SetRelationHasSubclass(Oid relationId, bool relhassubclass)
    }
 
    heap_freetuple(tuple);
-   heap_close(relationRelation, RowExclusiveLock);
+   table_close(relationRelation, RowExclusiveLock);
 }
 
 /*
@@ -2864,7 +2864,7 @@ renameatt_internal(Oid myrelid,
            renameatt_internal(lfirst_oid(lo), oldattname, newattname, true, true, 0, behavior);
    }
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    atttup = SearchSysCacheCopyAttName(myrelid, oldattname);
    if (!HeapTupleIsValid(atttup))
@@ -2908,7 +2908,7 @@ renameatt_internal(Oid myrelid,
 
    heap_freetuple(atttup);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    relation_close(targetrelation, NoLock); /* close rel but keep lock */
 
@@ -3094,13 +3094,13 @@ RenameConstraint(RenameStmt *stmt)
        HeapTuple   tup;
 
        typid = typenameTypeId(NULL, makeTypeNameFromNameList(castNode(List, stmt->object)));
-       rel = heap_open(TypeRelationId, RowExclusiveLock);
+       rel = table_open(TypeRelationId, RowExclusiveLock);
        tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typid));
        if (!HeapTupleIsValid(tup))
            elog(ERROR, "cache lookup failed for type %u", typid);
        checkDomainOwner(tup);
        ReleaseSysCache(tup);
-       heap_close(rel, NoLock);
+       table_close(rel, NoLock);
    }
    else
    {
@@ -3198,7 +3198,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
    /*
     * Find relation's pg_class tuple, and make sure newrelname isn't in use.
     */
-   relrelation = heap_open(RelationRelationId, RowExclusiveLock);
+   relrelation = table_open(RelationRelationId, RowExclusiveLock);
 
    reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
    if (!HeapTupleIsValid(reltup))  /* shouldn't happen */
@@ -3223,7 +3223,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bo
                                 InvalidOid, is_internal);
 
    heap_freetuple(reltup);
-   heap_close(relrelation, RowExclusiveLock);
+   table_close(relrelation, RowExclusiveLock);
 
    /*
     * Also rename the associated type, if any.
@@ -4372,9 +4372,9 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
        {
            Relation    rel;
 
-           rel = heap_open(tab->relid, NoLock);
+           rel = table_open(tab->relid, NoLock);
            find_composite_type_dependencies(rel->rd_rel->reltype, rel, NULL);
-           heap_close(rel, NoLock);
+           table_close(rel, NoLock);
        }
 
        /*
@@ -4397,7 +4397,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
            Oid         NewTableSpace;
            char        persistence;
 
-           OldHeap = heap_open(tab->relid, NoLock);
+           OldHeap = table_open(tab->relid, NoLock);
 
            /*
             * We don't support rewriting of system catalogs; there are too
@@ -4441,7 +4441,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
            persistence = tab->chgPersistence ?
                tab->newrelpersistence : OldHeap->rd_rel->relpersistence;
 
-           heap_close(OldHeap, NoLock);
+           table_close(OldHeap, NoLock);
 
            /*
             * Fire off an Event Trigger now, before actually rewriting the
@@ -4542,10 +4542,10 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
                if (rel == NULL)
                {
                    /* Long since locked, no need for another */
-                   rel = heap_open(tab->relid, NoLock);
+                   rel = table_open(tab->relid, NoLock);
                }
 
-               refrel = heap_open(con->refrelid, RowShareLock);
+               refrel = table_open(con->refrelid, RowShareLock);
 
                validateForeignKeyConstraint(fkconstraint->conname, rel, refrel,
                                             con->refindid,
@@ -4556,12 +4556,12 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
                 * that when we inserted the row earlier.
                 */
 
-               heap_close(refrel, NoLock);
+               table_close(refrel, NoLock);
            }
        }
 
        if (rel)
-           heap_close(rel, NoLock);
+           table_close(rel, NoLock);
    }
 }
 
@@ -4591,12 +4591,12 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
     * Open the relation(s).  We have surely already locked the existing
     * table.
     */
-   oldrel = heap_open(tab->relid, NoLock);
+   oldrel = table_open(tab->relid, NoLock);
    oldTupDesc = tab->oldDesc;
    newTupDesc = RelationGetDescr(oldrel);  /* includes all mods */
 
    if (OidIsValid(OIDNewHeap))
-       newrel = heap_open(OIDNewHeap, lockmode);
+       newrel = table_open(OIDNewHeap, lockmode);
    else
        newrel = NULL;
 
@@ -4872,7 +4872,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
 
    FreeExecutorState(estate);
 
-   heap_close(oldrel, NoLock);
+   table_close(oldrel, NoLock);
    if (newrel)
    {
        FreeBulkInsertState(bistate);
@@ -4881,7 +4881,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
        if (hi_options & HEAP_INSERT_SKIP_WAL)
            heap_sync(newrel);
 
-       heap_close(newrel, NoLock);
+       table_close(newrel, NoLock);
    }
 }
 
@@ -5151,7 +5151,7 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
     * We scan pg_depend to find those things that depend on the given type.
     * (We assume we can ignore refobjsubid for a type.)
     */
-   depRel = heap_open(DependRelationId, AccessShareLock);
+   depRel = table_open(DependRelationId, AccessShareLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_depend_refclassid,
@@ -5262,7 +5262,7 @@ find_typed_table_dependencies(Oid typeOid, const char *typeName, DropBehavior be
    HeapTuple   tuple;
    List       *result = NIL;
 
-   classRel = heap_open(RelationRelationId, AccessShareLock);
+   classRel = table_open(RelationRelationId, AccessShareLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_class_reloftype,
@@ -5286,7 +5286,7 @@ find_typed_table_dependencies(Oid typeOid, const char *typeName, DropBehavior be
    }
 
    heap_endscan(scan);
-   heap_close(classRel, AccessShareLock);
+   table_close(classRel, AccessShareLock);
 
    return result;
 }
@@ -5398,7 +5398,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("cannot add column to a partition")));
 
-   attrdesc = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrdesc = table_open(AttributeRelationId, RowExclusiveLock);
 
    /*
     * Are we adding the column to a recursion child?  If so, check whether to
@@ -5448,12 +5448,12 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
                    (errmsg("merging definition of column \"%s\" for child \"%s\"",
                            colDef->colname, RelationGetRelationName(rel))));
 
-           heap_close(attrdesc, RowExclusiveLock);
+           table_close(attrdesc, RowExclusiveLock);
            return InvalidObjectAddress;
        }
    }
 
-   pgclass = heap_open(RelationRelationId, RowExclusiveLock);
+   pgclass = table_open(RelationRelationId, RowExclusiveLock);
 
    reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
    if (!HeapTupleIsValid(reltup))
@@ -5474,9 +5474,9 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
    /* skip if the name already exists and if_not_exists is true */
    if (!check_for_column_name_collision(rel, colDef->colname, if_not_exists))
    {
-       heap_close(attrdesc, RowExclusiveLock);
+       table_close(attrdesc, RowExclusiveLock);
        heap_freetuple(reltup);
-       heap_close(pgclass, RowExclusiveLock);
+       table_close(pgclass, RowExclusiveLock);
        return InvalidObjectAddress;
    }
 
@@ -5529,7 +5529,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
 
    InsertPgAttributeTuple(attrdesc, &attribute, NULL);
 
-   heap_close(attrdesc, RowExclusiveLock);
+   table_close(attrdesc, RowExclusiveLock);
 
    /*
     * Update pg_class tuple as appropriate
@@ -5543,7 +5543,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
    /* Post creation hook for new attribute */
    InvokeObjectPostCreateHook(RelationRelationId, myrelid, newattnum);
 
-   heap_close(pgclass, RowExclusiveLock);
+   table_close(pgclass, RowExclusiveLock);
 
    /* Make the attribute's catalog entry visible */
    CommandCounterIncrement();
@@ -5719,7 +5719,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
        AlteredTableInfo *childtab;
 
        /* find_inheritance_children already got lock */
-       childrel = heap_open(childrelid, NoLock);
+       childrel = table_open(childrelid, NoLock);
        CheckTableNotInUse(childrel, "ALTER TABLE");
 
        /* Find or create work queue entry for this table */
@@ -5730,7 +5730,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
                        colDef, recurse, true,
                        if_not_exists, lockmode);
 
-       heap_close(childrel, NoLock);
+       table_close(childrel, NoLock);
    }
 
    ObjectAddressSubSet(address, RelationRelationId, myrelid, newattnum);
@@ -5871,7 +5871,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
    /*
     * lookup the attribute
     */
-   attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
+   attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
    if (!HeapTupleIsValid(tuple))
@@ -5942,7 +5942,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
    if (rel->rd_rel->relispartition)
    {
        Oid         parentId = get_partition_parent(RelationGetRelid(rel));
-       Relation    parent = heap_open(parentId, AccessShareLock);
+       Relation    parent = table_open(parentId, AccessShareLock);
        TupleDesc   tupDesc = RelationGetDescr(parent);
        AttrNumber  parent_attnum;
 
@@ -5952,7 +5952,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
                    (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
                     errmsg("column \"%s\" is marked NOT NULL in parent table",
                            colName)));
-       heap_close(parent, AccessShareLock);
+       table_close(parent, AccessShareLock);
    }
 
    /*
@@ -5973,7 +5973,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
    InvokeObjectPostAlterHook(RelationRelationId,
                              RelationGetRelid(rel), attnum);
 
-   heap_close(attr_rel, RowExclusiveLock);
+   table_close(attr_rel, RowExclusiveLock);
 
    return address;
 }
@@ -6018,7 +6018,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
    /*
     * lookup the attribute
     */
-   attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
+   attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
 
@@ -6058,7 +6058,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
    InvokeObjectPostAlterHook(RelationRelationId,
                              RelationGetRelid(rel), attnum);
 
-   heap_close(attr_rel, RowExclusiveLock);
+   table_close(attr_rel, RowExclusiveLock);
 
    return address;
 }
@@ -6151,7 +6151,7 @@ ATExecAddIdentity(Relation rel, const char *colName,
    ObjectAddress address;
    ColumnDef  *cdef = castNode(ColumnDef, def);
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
    if (!HeapTupleIsValid(tuple))
@@ -6202,7 +6202,7 @@ ATExecAddIdentity(Relation rel, const char *colName,
                        RelationGetRelid(rel), attnum);
    heap_freetuple(tuple);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    return address;
 }
@@ -6246,7 +6246,7 @@ ATExecSetIdentity(Relation rel, const char *colName, Node *def, LOCKMODE lockmod
     * there.
     */
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
    if (!HeapTupleIsValid(tuple))
        ereport(ERROR,
@@ -6284,7 +6284,7 @@ ATExecSetIdentity(Relation rel, const char *colName, Node *def, LOCKMODE lockmod
        address = InvalidObjectAddress;
 
    heap_freetuple(tuple);
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    return address;
 }
@@ -6305,7 +6305,7 @@ ATExecDropIdentity(Relation rel, const char *colName, bool missing_ok, LOCKMODE
    Oid         seqid;
    ObjectAddress seqaddress;
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
    if (!HeapTupleIsValid(tuple))
        ereport(ERROR,
@@ -6335,7 +6335,7 @@ ATExecDropIdentity(Relation rel, const char *colName, bool missing_ok, LOCKMODE
                    (errmsg("column \"%s\" of relation \"%s\" is not an identity column, skipping",
                            colName, RelationGetRelationName(rel))));
            heap_freetuple(tuple);
-           heap_close(attrelation, RowExclusiveLock);
+           table_close(attrelation, RowExclusiveLock);
            return InvalidObjectAddress;
        }
    }
@@ -6350,7 +6350,7 @@ ATExecDropIdentity(Relation rel, const char *colName, bool missing_ok, LOCKMODE
                        RelationGetRelid(rel), attnum);
    heap_freetuple(tuple);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    /* drop the internal sequence */
    seqid = getOwnedSequence(RelationGetRelid(rel), attnum);
@@ -6440,7 +6440,7 @@ ATExecSetStatistics(Relation rel, const char *colName, int16 colNum, Node *newVa
                        newtarget)));
    }
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    if (colName)
    {
@@ -6499,7 +6499,7 @@ ATExecSetStatistics(Relation rel, const char *colName, int16 colNum, Node *newVa
                        RelationGetRelid(rel), attnum);
    heap_freetuple(tuple);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    return address;
 }
@@ -6524,7 +6524,7 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options,
    bool        repl_null[Natts_pg_attribute];
    bool        repl_repl[Natts_pg_attribute];
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheAttName(RelationGetRelid(rel), colName);
 
@@ -6575,7 +6575,7 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options,
 
    ReleaseSysCache(tuple);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    return address;
 }
@@ -6616,7 +6616,7 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue, LOCKMODE loc
        newstorage = 0;         /* keep compiler quiet */
    }
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
 
@@ -6654,7 +6654,7 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue, LOCKMODE loc
 
    heap_freetuple(tuple);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    ObjectAddressSubSet(address, RelationRelationId,
                        RelationGetRelid(rel), attnum);
@@ -6785,7 +6785,7 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
                     errmsg("cannot drop column from only the partitioned table when partitions exist"),
                     errhint("Do not specify the ONLY keyword.")));
 
-       attr_rel = heap_open(AttributeRelationId, RowExclusiveLock);
+       attr_rel = table_open(AttributeRelationId, RowExclusiveLock);
        foreach(child, children)
        {
            Oid         childrelid = lfirst_oid(child);
@@ -6793,7 +6793,7 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
            Form_pg_attribute childatt;
 
            /* find_inheritance_children already got lock */
-           childrel = heap_open(childrelid, NoLock);
+           childrel = table_open(childrelid, NoLock);
            CheckTableNotInUse(childrel, "ALTER TABLE");
 
            tuple = SearchSysCacheCopyAttName(childrelid, colName);
@@ -6849,9 +6849,9 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
 
            heap_freetuple(tuple);
 
-           heap_close(childrel, NoLock);
+           table_close(childrel, NoLock);
        }
-       heap_close(attr_rel, RowExclusiveLock);
+       table_close(attr_rel, RowExclusiveLock);
    }
 
    /*
@@ -7206,7 +7206,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
        AlteredTableInfo *childtab;
 
        /* find_inheritance_children already got lock */
-       childrel = heap_open(childrelid, NoLock);
+       childrel = table_open(childrelid, NoLock);
        CheckTableNotInUse(childrel, "ALTER TABLE");
 
        /* Find or create work queue entry for this table */
@@ -7216,7 +7216,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
        ATAddCheckConstraint(wqueue, childtab, childrel,
                             constr, recurse, true, is_readd, lockmode);
 
-       heap_close(childrel, NoLock);
+       table_close(childrel, NoLock);
    }
 
    return address;
@@ -7258,9 +7258,9 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
     * delete rows out from under us.
     */
    if (OidIsValid(fkconstraint->old_pktable_oid))
-       pkrel = heap_open(fkconstraint->old_pktable_oid, ShareRowExclusiveLock);
+       pkrel = table_open(fkconstraint->old_pktable_oid, ShareRowExclusiveLock);
    else
-       pkrel = heap_openrv(fkconstraint->pktable, ShareRowExclusiveLock);
+       pkrel = table_openrv(fkconstraint->pktable, ShareRowExclusiveLock);
 
    /*
     * Validity checks (permission checks wait till we have the column
@@ -7662,13 +7662,13 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
        List       *cloned = NIL;
        ListCell   *cell;
 
-       pg_constraint = heap_open(ConstraintRelationId, RowExclusiveLock);
+       pg_constraint = table_open(ConstraintRelationId, RowExclusiveLock);
        partdesc = RelationGetPartitionDesc(rel);
 
        for (i = 0; i < partdesc->nparts; i++)
        {
            Oid         partitionId = partdesc->oids[i];
-           Relation    partition = heap_open(partitionId, lockmode);
+           Relation    partition = table_open(partitionId, lockmode);
 
            CheckTableNotInUse(partition, "ALTER TABLE");
 
@@ -7676,14 +7676,14 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
                               list_make1_oid(constrOid),
                               &cloned);
 
-           heap_close(partition, NoLock);
+           table_close(partition, NoLock);
        }
-       heap_close(pg_constraint, RowExclusiveLock);
+       table_close(pg_constraint, RowExclusiveLock);
 
        foreach(cell, cloned)
        {
            ClonedConstraint *cc = (ClonedConstraint *) lfirst(cell);
-           Relation    partition = heap_open(cc->relid, lockmode);
+           Relation    partition = table_open(cc->relid, lockmode);
            AlteredTableInfo *childtab;
            NewConstraint *newcon;
 
@@ -7700,14 +7700,14 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
 
            childtab->constraints = lappend(childtab->constraints, newcon);
 
-           heap_close(partition, lockmode);
+           table_close(partition, lockmode);
        }
    }
 
    /*
     * Close pk table, but keep lock until we've committed.
     */
-   heap_close(pkrel, NoLock);
+   table_close(pkrel, NoLock);
 
    return address;
 }
@@ -7736,10 +7736,10 @@ CloneForeignKeyConstraints(Oid parentId, Oid relationId, List **cloned)
    HeapTuple   tuple;
    List       *clone = NIL;
 
-   parentRel = heap_open(parentId, NoLock);    /* already got lock */
+   parentRel = table_open(parentId, NoLock);   /* already got lock */
    /* see ATAddForeignKeyConstraint about lock level */
-   rel = heap_open(relationId, AccessExclusiveLock);
-   pg_constraint = heap_open(ConstraintRelationId, RowShareLock);
+   rel = table_open(relationId, AccessExclusiveLock);
+   pg_constraint = table_open(ConstraintRelationId, RowShareLock);
 
    /* Obtain the list of constraints to clone or attach */
    ScanKeyInit(&key,
@@ -7759,9 +7759,9 @@ CloneForeignKeyConstraints(Oid parentId, Oid relationId, List **cloned)
    CloneFkReferencing(pg_constraint, parentRel, rel, clone, cloned);
 
    /* We're done.  Clean up */
-   heap_close(parentRel, NoLock);
-   heap_close(rel, NoLock);    /* keep lock till commit */
-   heap_close(pg_constraint, RowShareLock);
+   table_close(parentRel, NoLock);
+   table_close(rel, NoLock);   /* keep lock till commit */
+   table_close(pg_constraint, RowShareLock);
 }
 
 /*
@@ -8003,13 +8003,13 @@ CloneFkReferencing(Relation pg_constraint, Relation parentRel,
        {
            Relation    childRel;
 
-           childRel = heap_open(partdesc->oids[i], AccessExclusiveLock);
+           childRel = table_open(partdesc->oids[i], AccessExclusiveLock);
            CloneFkReferencing(pg_constraint,
                               partRel,
                               childRel,
                               subclone,
                               cloned);
-           heap_close(childRel, NoLock);   /* keep lock till commit */
+           table_close(childRel, NoLock);  /* keep lock till commit */
        }
    }
 }
@@ -8041,7 +8041,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd,
 
    cmdcon = castNode(Constraint, cmd->def);
 
-   conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
+   conrel = table_open(ConstraintRelationId, RowExclusiveLock);
 
    /*
     * Find and check the target constraint
@@ -8105,7 +8105,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd,
         * Now we need to update the multiple entries in pg_trigger that
         * implement the constraint.
         */
-       tgrel = heap_open(TriggerRelationId, RowExclusiveLock);
+       tgrel = table_open(TriggerRelationId, RowExclusiveLock);
 
        ScanKeyInit(&tgkey,
                    Anum_pg_trigger_tgconstraint,
@@ -8156,7 +8156,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd,
 
        systable_endscan(tgscan);
 
-       heap_close(tgrel, RowExclusiveLock);
+       table_close(tgrel, RowExclusiveLock);
 
        /*
         * Invalidate relcache so that others see the new attributes.  We must
@@ -8177,7 +8177,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd,
 
    systable_endscan(scan);
 
-   heap_close(conrel, RowExclusiveLock);
+   table_close(conrel, RowExclusiveLock);
 
    return address;
 }
@@ -8204,7 +8204,7 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
    Form_pg_constraint con;
    ObjectAddress address;
 
-   conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
+   conrel = table_open(ConstraintRelationId, RowExclusiveLock);
 
    /*
     * Find and check the target constraint
@@ -8256,12 +8256,12 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
             * might need to fire triggers to perform the check, so we take a
             * lock at RowShareLock level just in case.
             */
-           refrel = heap_open(con->confrelid, RowShareLock);
+           refrel = table_open(con->confrelid, RowShareLock);
 
            validateForeignKeyConstraint(constrName, rel, refrel,
                                         con->conindid,
                                         con->oid);
-           heap_close(refrel, NoLock);
+           table_close(refrel, NoLock);
 
            /*
             * We disallow creating invalid foreign keys to or from
@@ -8309,11 +8309,11 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
                             errmsg("constraint must be validated on child tables too")));
 
                /* find_all_inheritors already got lock */
-               childrel = heap_open(childoid, NoLock);
+               childrel = table_open(childoid, NoLock);
 
                ATExecValidateConstraint(childrel, constrName, false,
                                         true, lockmode);
-               heap_close(childrel, NoLock);
+               table_close(childrel, NoLock);
            }
 
            validateCheckConstraint(rel, tuple);
@@ -8344,7 +8344,7 @@ ATExecValidateConstraint(Relation rel, char *constrName, bool recurse,
 
    systable_endscan(scan);
 
-   heap_close(conrel, RowExclusiveLock);
+   table_close(conrel, RowExclusiveLock);
 
    return address;
 }
@@ -9101,7 +9101,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
    if (recursing)
        ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
 
-   conrel = heap_open(ConstraintRelationId, RowExclusiveLock);
+   conrel = table_open(ConstraintRelationId, RowExclusiveLock);
 
    /*
     * Find and drop the target constraint
@@ -9150,9 +9150,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
            Relation    frel;
 
            /* Must match lock taken by RemoveTriggerById: */
-           frel = heap_open(con->confrelid, AccessExclusiveLock);
+           frel = table_open(con->confrelid, AccessExclusiveLock);
            CheckTableNotInUse(frel, "ALTER TABLE");
-           heap_close(frel, NoLock);
+           table_close(frel, NoLock);
        }
 
        /*
@@ -9183,7 +9183,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
            ereport(NOTICE,
                    (errmsg("constraint \"%s\" of relation \"%s\" does not exist, skipping",
                            constrName, RelationGetRelationName(rel))));
-           heap_close(conrel, RowExclusiveLock);
+           table_close(conrel, RowExclusiveLock);
            return;
        }
    }
@@ -9217,7 +9217,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
        HeapTuple   copy_tuple;
 
        /* find_inheritance_children already got lock */
-       childrel = heap_open(childrelid, NoLock);
+       childrel = table_open(childrelid, NoLock);
        CheckTableNotInUse(childrel, "ALTER TABLE");
 
        ScanKeyInit(&skey[0],
@@ -9298,10 +9298,10 @@ ATExecDropConstraint(Relation rel, const char *constrName,
 
        heap_freetuple(copy_tuple);
 
-       heap_close(childrel, NoLock);
+       table_close(childrel, NoLock);
    }
 
-   heap_close(conrel, RowExclusiveLock);
+   table_close(conrel, RowExclusiveLock);
 }
 
 /*
@@ -9618,14 +9618,14 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
    {
        Relation    newrel;
 
-       newrel = heap_open(RelationGetRelid(rel), NoLock);
+       newrel = table_open(RelationGetRelid(rel), NoLock);
        RelationClearMissing(newrel);
        relation_close(newrel, NoLock);
        /* make sure we don't conflict with later attribute modifications */
        CommandCounterIncrement();
    }
 
-   attrelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrelation = table_open(AttributeRelationId, RowExclusiveLock);
 
    /* Look up the target column */
    heapTup = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName);
@@ -9699,7 +9699,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
     * that implements a constraint will not show a direct dependency on the
     * column.
     */
-   depRel = heap_open(DependRelationId, RowExclusiveLock);
+   depRel = table_open(DependRelationId, RowExclusiveLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_depend_refclassid,
@@ -9936,7 +9936,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
 
    systable_endscan(scan);
 
-   heap_close(depRel, RowExclusiveLock);
+   table_close(depRel, RowExclusiveLock);
 
    /*
     * Here we go --- change the recorded column type and collation.  (Note
@@ -10020,7 +10020,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
 
    CatalogTupleUpdate(attrelation, &heapTup->t_self, heapTup);
 
-   heap_close(attrelation, RowExclusiveLock);
+   table_close(attrelation, RowExclusiveLock);
 
    /* Install dependencies on new datatype and collation */
    add_column_datatype_dependency(RelationGetRelid(rel), attnum, targettype);
@@ -10094,7 +10094,7 @@ ATExecAlterColumnGenericOptions(Relation rel,
        return InvalidObjectAddress;
 
    /* First, determine FDW validator associated to the foreign table. */
-   ftrel = heap_open(ForeignTableRelationId, AccessShareLock);
+   ftrel = table_open(ForeignTableRelationId, AccessShareLock);
    tuple = SearchSysCache1(FOREIGNTABLEREL, rel->rd_id);
    if (!HeapTupleIsValid(tuple))
        ereport(ERROR,
@@ -10105,10 +10105,10 @@ ATExecAlterColumnGenericOptions(Relation rel,
    server = GetForeignServer(fttableform->ftserver);
    fdw = GetForeignDataWrapper(server->fdwid);
 
-   heap_close(ftrel, AccessShareLock);
+   table_close(ftrel, AccessShareLock);
    ReleaseSysCache(tuple);
 
-   attrel = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrel = table_open(AttributeRelationId, RowExclusiveLock);
    tuple = SearchSysCacheAttName(RelationGetRelid(rel), colName);
    if (!HeapTupleIsValid(tuple))
        ereport(ERROR,
@@ -10166,7 +10166,7 @@ ATExecAlterColumnGenericOptions(Relation rel,
 
    ReleaseSysCache(tuple);
 
-   heap_close(attrel, RowExclusiveLock);
+   table_close(attrel, RowExclusiveLock);
 
    heap_freetuple(newtuple);
 
@@ -10595,7 +10595,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
    target_rel = relation_open(relationOid, lockmode);
 
    /* Get its pg_class tuple, too */
-   class_rel = heap_open(RelationRelationId, RowExclusiveLock);
+   class_rel = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relationOid));
    if (!HeapTupleIsValid(tuple))
@@ -10809,7 +10809,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
    InvokeObjectPostAlterHook(RelationRelationId, relationOid, 0);
 
    ReleaseSysCache(tuple);
-   heap_close(class_rel, RowExclusiveLock);
+   table_close(class_rel, RowExclusiveLock);
    relation_close(target_rel, NoLock);
 }
 
@@ -10827,7 +10827,7 @@ change_owner_fix_column_acls(Oid relationOid, Oid oldOwnerId, Oid newOwnerId)
    ScanKeyData key[1];
    HeapTuple   attributeTuple;
 
-   attRelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   attRelation = table_open(AttributeRelationId, RowExclusiveLock);
    ScanKeyInit(&key[0],
                Anum_pg_attribute_attrelid,
                BTEqualStrategyNumber, F_OIDEQ,
@@ -10874,7 +10874,7 @@ change_owner_fix_column_acls(Oid relationOid, Oid oldOwnerId, Oid newOwnerId)
        heap_freetuple(newtuple);
    }
    systable_endscan(scan);
-   heap_close(attRelation, RowExclusiveLock);
+   table_close(attRelation, RowExclusiveLock);
 }
 
 /*
@@ -10896,7 +10896,7 @@ change_owner_recurse_to_sequences(Oid relationOid, Oid newOwnerId, LOCKMODE lock
     * SERIAL sequences are those having an auto dependency on one of the
     * table's columns (we don't care *which* column, exactly).
     */
-   depRel = heap_open(DependRelationId, AccessShareLock);
+   depRel = table_open(DependRelationId, AccessShareLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_depend_refclassid,
@@ -11043,7 +11043,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
    if (defList == NIL && operation != AT_ReplaceRelOptions)
        return;                 /* nothing to do */
 
-   pgclass = heap_open(RelationRelationId, RowExclusiveLock);
+   pgclass = table_open(RelationRelationId, RowExclusiveLock);
 
    /* Fetch heap tuple */
    relid = RelationGetRelid(rel);
@@ -11161,7 +11161,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
        Relation    toastrel;
        Oid         toastid = rel->rd_rel->reltoastrelid;
 
-       toastrel = heap_open(toastid, lockmode);
+       toastrel = table_open(toastid, lockmode);
 
        /* Fetch heap tuple */
        tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(toastid));
@@ -11214,10 +11214,10 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
 
        ReleaseSysCache(tuple);
 
-       heap_close(toastrel, NoLock);
+       table_close(toastrel, NoLock);
    }
 
-   heap_close(pgclass, RowExclusiveLock);
+   table_close(pgclass, RowExclusiveLock);
 }
 
 /*
@@ -11295,7 +11295,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, LOCKMODE lockmode)
    }
 
    /* Get a modifiable copy of the relation's pg_class row */
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(tableOid));
    if (!HeapTupleIsValid(tuple))
@@ -11371,7 +11371,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, LOCKMODE lockmode)
 
    heap_freetuple(tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
 
    relation_close(rel, NoLock);
 
@@ -11428,7 +11428,7 @@ ATExecSetTableSpaceNoStorage(Relation rel, Oid newTableSpace)
    }
 
    /* Get a modifiable copy of the relation's pg_class row */
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(reloid));
    if (!HeapTupleIsValid(tuple))
@@ -11443,7 +11443,7 @@ ATExecSetTableSpaceNoStorage(Relation rel, Oid newTableSpace)
 
    heap_freetuple(tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
 
    /* Make sure the reltablespace change is visible */
    CommandCounterIncrement();
@@ -11532,7 +11532,7 @@ AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(orig_tablespaceoid));
 
-   rel = heap_open(RelationRelationId, AccessShareLock);
+   rel = table_open(RelationRelationId, AccessShareLock);
    scan = heap_beginscan_catalog(rel, 1, key);
    while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
    {
@@ -11593,7 +11593,7 @@ AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
    }
 
    heap_endscan(scan);
-   heap_close(rel, AccessShareLock);
+   table_close(rel, AccessShareLock);
 
    if (relations == NIL)
        ereport(NOTICE,
@@ -11773,7 +11773,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode)
     * A self-exclusive lock is needed here.  See the similar case in
     * MergeAttributes() for a full explanation.
     */
-   parent_rel = heap_openrv(parent, ShareUpdateExclusiveLock);
+   parent_rel = table_openrv(parent, ShareUpdateExclusiveLock);
 
    /*
     * Must be owner of both parent and child -- child was checked by
@@ -11861,7 +11861,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode)
                     RelationGetRelid(parent_rel));
 
    /* keep our lock on the parent relation until commit */
-   heap_close(parent_rel, NoLock);
+   table_close(parent_rel, NoLock);
 
    return address;
 }
@@ -11883,7 +11883,7 @@ CreateInheritance(Relation child_rel, Relation parent_rel)
    int32       inhseqno;
 
    /* Note: get RowExclusiveLock because we will write pg_inherits below. */
-   catalogRelation = heap_open(InheritsRelationId, RowExclusiveLock);
+   catalogRelation = table_open(InheritsRelationId, RowExclusiveLock);
 
    /*
     * Check for duplicates in the list of parents, and determine the highest
@@ -11935,7 +11935,7 @@ CreateInheritance(Relation child_rel, Relation parent_rel)
                             RELKIND_PARTITIONED_TABLE);
 
    /* Now we're done with pg_inherits */
-   heap_close(catalogRelation, RowExclusiveLock);
+   table_close(catalogRelation, RowExclusiveLock);
 }
 
 /*
@@ -12006,7 +12006,7 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel)
    HeapTuple   tuple;
    bool        child_is_partition = false;
 
-   attrrel = heap_open(AttributeRelationId, RowExclusiveLock);
+   attrrel = table_open(AttributeRelationId, RowExclusiveLock);
 
    tupleDesc = RelationGetDescr(parent_rel);
    parent_natts = tupleDesc->natts;
@@ -12087,7 +12087,7 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel)
        }
    }
 
-   heap_close(attrrel, RowExclusiveLock);
+   table_close(attrrel, RowExclusiveLock);
 }
 
 /*
@@ -12117,7 +12117,7 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
    HeapTuple   parent_tuple;
    bool        child_is_partition = false;
 
-   catalog_relation = heap_open(ConstraintRelationId, RowExclusiveLock);
+   catalog_relation = table_open(ConstraintRelationId, RowExclusiveLock);
    tuple_desc = RelationGetDescr(catalog_relation);
 
    /* If parent_rel is a partitioned table, child_rel must be a partition */
@@ -12229,7 +12229,7 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
    }
 
    systable_endscan(parent_scan);
-   heap_close(catalog_relation, RowExclusiveLock);
+   table_close(catalog_relation, RowExclusiveLock);
 }
 
 /*
@@ -12253,7 +12253,7 @@ ATExecDropInherit(Relation rel, RangeVar *parent, LOCKMODE lockmode)
     * TABLE doesn't lock parent tables at all.  We need some lock since we'll
     * be inspecting the parent's schema.
     */
-   parent_rel = heap_openrv(parent, AccessShareLock);
+   parent_rel = table_openrv(parent, AccessShareLock);
 
    /*
     * We don't bother to check ownership of the parent table --- ownership of
@@ -12267,7 +12267,7 @@ ATExecDropInherit(Relation rel, RangeVar *parent, LOCKMODE lockmode)
                     RelationGetRelid(parent_rel));
 
    /* keep our lock on the parent relation until commit */
-   heap_close(parent_rel, NoLock);
+   table_close(parent_rel, NoLock);
 
    return address;
 }
@@ -12327,7 +12327,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel)
    /*
     * Search through child columns looking for ones matching parent rel
     */
-   catalogRelation = heap_open(AttributeRelationId, RowExclusiveLock);
+   catalogRelation = table_open(AttributeRelationId, RowExclusiveLock);
    ScanKeyInit(&key[0],
                Anum_pg_attribute_attrelid,
                BTEqualStrategyNumber, F_OIDEQ,
@@ -12360,7 +12360,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel)
        }
    }
    systable_endscan(scan);
-   heap_close(catalogRelation, RowExclusiveLock);
+   table_close(catalogRelation, RowExclusiveLock);
 
    /*
     * Likewise, find inherited check constraints and disinherit them. To do
@@ -12368,7 +12368,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel)
     * constraints.  (We cheat a bit by only checking for name matches,
     * assuming that the expressions will match.)
     */
-   catalogRelation = heap_open(ConstraintRelationId, RowExclusiveLock);
+   catalogRelation = table_open(ConstraintRelationId, RowExclusiveLock);
    ScanKeyInit(&key[0],
                Anum_pg_constraint_conrelid,
                BTEqualStrategyNumber, F_OIDEQ,
@@ -12435,7 +12435,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel)
    }
 
    systable_endscan(scan);
-   heap_close(catalogRelation, RowExclusiveLock);
+   table_close(catalogRelation, RowExclusiveLock);
 
    drop_parent_dependency(RelationGetRelid(child_rel),
                           RelationRelationId,
@@ -12468,7 +12468,7 @@ drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid,
    ScanKeyData key[3];
    HeapTuple   depTuple;
 
-   catalogRelation = heap_open(DependRelationId, RowExclusiveLock);
+   catalogRelation = table_open(DependRelationId, RowExclusiveLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_depend_classid,
@@ -12498,7 +12498,7 @@ drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid,
    }
 
    systable_endscan(scan);
-   heap_close(catalogRelation, RowExclusiveLock);
+   table_close(catalogRelation, RowExclusiveLock);
 }
 
 /*
@@ -12537,7 +12537,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
    typeid = typeform->oid;
 
    /* Fail if the table has any inheritance parents. */
-   inheritsRelation = heap_open(InheritsRelationId, AccessShareLock);
+   inheritsRelation = table_open(InheritsRelationId, AccessShareLock);
    ScanKeyInit(&key,
                Anum_pg_inherits_inhrelid,
                BTEqualStrategyNumber, F_OIDEQ,
@@ -12549,7 +12549,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("typed tables cannot inherit")));
    systable_endscan(scan);
-   heap_close(inheritsRelation, AccessShareLock);
+   table_close(inheritsRelation, AccessShareLock);
 
    /*
     * Check the tuple descriptors for compatibility.  Unlike inheritance, we
@@ -12630,7 +12630,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
    recordDependencyOn(&tableobj, &typeobj, DEPENDENCY_NORMAL);
 
    /* Update pg_class.reloftype */
-   relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
+   relationRelation = table_open(RelationRelationId, RowExclusiveLock);
    classtuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
    if (!HeapTupleIsValid(classtuple))
        elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -12640,7 +12640,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
    InvokeObjectPostAlterHook(RelationRelationId, relid, 0);
 
    heap_freetuple(classtuple);
-   heap_close(relationRelation, RowExclusiveLock);
+   table_close(relationRelation, RowExclusiveLock);
 
    ReleaseSysCache(typetuple);
 
@@ -12675,7 +12675,7 @@ ATExecDropOf(Relation rel, LOCKMODE lockmode)
                           DEPENDENCY_NORMAL);
 
    /* Clear pg_class.reloftype */
-   relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
+   relationRelation = table_open(RelationRelationId, RowExclusiveLock);
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
    if (!HeapTupleIsValid(tuple))
        elog(ERROR, "cache lookup failed for relation %u", relid);
@@ -12685,7 +12685,7 @@ ATExecDropOf(Relation rel, LOCKMODE lockmode)
    InvokeObjectPostAlterHook(RelationRelationId, relid, 0);
 
    heap_freetuple(tuple);
-   heap_close(relationRelation, RowExclusiveLock);
+   table_close(relationRelation, RowExclusiveLock);
 }
 
 /*
@@ -12710,7 +12710,7 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
    /*
     * Check whether relreplident has changed, and update it if so.
     */
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
    pg_class_tuple = SearchSysCacheCopy1(RELOID,
                                         ObjectIdGetDatum(RelationGetRelid(rel)));
    if (!HeapTupleIsValid(pg_class_tuple))
@@ -12722,7 +12722,7 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
        pg_class_form->relreplident = ri_type;
        CatalogTupleUpdate(pg_class, &pg_class_tuple->t_self, pg_class_tuple);
    }
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
    heap_freetuple(pg_class_tuple);
 
    /*
@@ -12750,7 +12750,7 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
     * Clear the indisreplident flag from any index that had it previously,
     * and set it for any index that should have it now.
     */
-   pg_index = heap_open(IndexRelationId, RowExclusiveLock);
+   pg_index = table_open(IndexRelationId, RowExclusiveLock);
    foreach(index, RelationGetIndexList(rel))
    {
        Oid         thisIndexOid = lfirst_oid(index);
@@ -12786,7 +12786,7 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
        heap_freetuple(pg_index_tuple);
    }
 
-   heap_close(pg_index, RowExclusiveLock);
+   table_close(pg_index, RowExclusiveLock);
 }
 
 /*
@@ -12916,7 +12916,7 @@ ATExecEnableRowSecurity(Relation rel)
 
    relid = RelationGetRelid(rel);
 
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 
@@ -12926,7 +12926,7 @@ ATExecEnableRowSecurity(Relation rel)
    ((Form_pg_class) GETSTRUCT(tuple))->relrowsecurity = true;
    CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
    heap_freetuple(tuple);
 }
 
@@ -12940,7 +12940,7 @@ ATExecDisableRowSecurity(Relation rel)
    relid = RelationGetRelid(rel);
 
    /* Pull the record for this relation and update it */
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 
@@ -12950,7 +12950,7 @@ ATExecDisableRowSecurity(Relation rel)
    ((Form_pg_class) GETSTRUCT(tuple))->relrowsecurity = false;
    CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
    heap_freetuple(tuple);
 }
 
@@ -12966,7 +12966,7 @@ ATExecForceNoForceRowSecurity(Relation rel, bool force_rls)
 
    relid = RelationGetRelid(rel);
 
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
 
@@ -12976,7 +12976,7 @@ ATExecForceNoForceRowSecurity(Relation rel, bool force_rls)
    ((Form_pg_class) GETSTRUCT(tuple))->relforcerowsecurity = force_rls;
    CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
    heap_freetuple(tuple);
 }
 
@@ -13000,7 +13000,7 @@ ATExecGenericOptions(Relation rel, List *options)
    if (options == NIL)
        return;
 
-   ftrel = heap_open(ForeignTableRelationId, RowExclusiveLock);
+   ftrel = table_open(ForeignTableRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(FOREIGNTABLEREL, rel->rd_id);
    if (!HeapTupleIsValid(tuple))
@@ -13053,7 +13053,7 @@ ATExecGenericOptions(Relation rel, List *options)
    InvokeObjectPostAlterHook(ForeignTableRelationId,
                              RelationGetRelid(rel), 0);
 
-   heap_close(ftrel, RowExclusiveLock);
+   table_close(ftrel, RowExclusiveLock);
 
    heap_freetuple(tuple);
 }
@@ -13119,7 +13119,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
     * permanent tables cannot reference unlogged ones.  Self-referencing
     * foreign keys can safely be ignored.
     */
-   pg_constraint = heap_open(ConstraintRelationId, AccessShareLock);
+   pg_constraint = table_open(ConstraintRelationId, AccessShareLock);
 
    /*
     * Scan conrelid if changing to permanent, else confrelid.  This also
@@ -13179,7 +13179,7 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
 
    systable_endscan(scan);
 
-   heap_close(pg_constraint, AccessShareLock);
+   table_close(pg_constraint, AccessShareLock);
 
    return true;
 }
@@ -13267,7 +13267,7 @@ AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid,
    Assert(objsMoved != NULL);
 
    /* OK, modify the pg_class row and pg_depend entry */
-   classRel = heap_open(RelationRelationId, RowExclusiveLock);
+   classRel = table_open(RelationRelationId, RowExclusiveLock);
 
    AlterRelationNamespaceInternal(classRel, RelationGetRelid(rel), oldNspOid,
                                   nspOid, true, objsMoved);
@@ -13288,7 +13288,7 @@ AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid,
                                  false, objsMoved);
    }
 
-   heap_close(classRel, RowExclusiveLock);
+   table_close(classRel, RowExclusiveLock);
 }
 
 /*
@@ -13425,7 +13425,7 @@ AlterSeqNamespaces(Relation classRel, Relation rel,
     * SERIAL sequences are those having an auto dependency on one of the
     * table's columns (we don't care *which* column, exactly).
     */
-   depRel = heap_open(DependRelationId, AccessShareLock);
+   depRel = table_open(DependRelationId, AccessShareLock);
 
    ScanKeyInit(&key[0],
                Anum_pg_depend_refclassid,
@@ -14380,7 +14380,7 @@ QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
            /*
             * This is the minimum lock we need to prevent deadlocks.
             */
-           part_rel = heap_open(partdesc->oids[i], AccessExclusiveLock);
+           part_rel = table_open(partdesc->oids[i], AccessExclusiveLock);
 
            /*
             * Adjust the constraint for scanrel so that it matches this
@@ -14396,7 +14396,7 @@ QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
            QueuePartitionConstraintValidation(wqueue, part_rel,
                                               thisPartConstraint,
                                               validate_default);
-           heap_close(part_rel, NoLock);   /* keep lock till commit */
+           table_close(part_rel, NoLock);  /* keep lock till commit */
        }
    }
 }
@@ -14435,7 +14435,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
    if (OidIsValid(defaultPartOid))
        LockRelationOid(defaultPartOid, AccessExclusiveLock);
 
-   attachrel = heap_openrv(cmd->name, AccessExclusiveLock);
+   attachrel = table_openrv(cmd->name, AccessExclusiveLock);
 
    /*
     * XXX I think it'd be a good idea to grab locks on all tables referenced
@@ -14464,7 +14464,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
     * Table being attached should not already be part of inheritance; either
     * as a child table...
     */
-   catalog = heap_open(InheritsRelationId, AccessShareLock);
+   catalog = table_open(InheritsRelationId, AccessShareLock);
    ScanKeyInit(&skey,
                Anum_pg_inherits_inhrelid,
                BTEqualStrategyNumber, F_OIDEQ,
@@ -14490,7 +14490,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("cannot attach inheritance parent as partition")));
    systable_endscan(scan);
-   heap_close(catalog, AccessShareLock);
+   table_close(catalog, AccessShareLock);
 
    /*
     * Prevent circularity by seeing if rel is a partition of attachrel. (In
@@ -14688,20 +14688,20 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
        Assert(!cmd->bound->is_default);
 
        /* we already hold a lock on the default partition */
-       defaultrel = heap_open(defaultPartOid, NoLock);
+       defaultrel = table_open(defaultPartOid, NoLock);
        defPartConstraint =
            get_proposed_default_constraint(partBoundConstraint);
        QueuePartitionConstraintValidation(wqueue, defaultrel,
                                           defPartConstraint, true);
 
        /* keep our lock until commit. */
-       heap_close(defaultrel, NoLock);
+       table_close(defaultrel, NoLock);
    }
 
    ObjectAddressSet(address, RelationRelationId, RelationGetRelid(attachrel));
 
    /* keep our lock until commit */
-   heap_close(attachrel, NoLock);
+   table_close(attachrel, NoLock);
 
    return address;
 }
@@ -14871,7 +14871,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition)
 
    ScanKeyInit(&key, Anum_pg_trigger_tgrelid, BTEqualStrategyNumber,
                F_OIDEQ, ObjectIdGetDatum(RelationGetRelid(parent)));
-   pg_trigger = heap_open(TriggerRelationId, RowExclusiveLock);
+   pg_trigger = table_open(TriggerRelationId, RowExclusiveLock);
    scan = systable_beginscan(pg_trigger, TriggerRelidNameIndexId,
                              true, NULL, 1, &key);
 
@@ -14977,7 +14977,7 @@ CloneRowTriggersToPartition(Relation parent, Relation partition)
    MemoryContextDelete(perTupCxt);
 
    systable_endscan(scan);
-   heap_close(pg_trigger, RowExclusiveLock);
+   table_close(pg_trigger, RowExclusiveLock);
 }
 
 /*
@@ -15010,13 +15010,13 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
    if (OidIsValid(defaultPartOid))
        LockRelationOid(defaultPartOid, AccessExclusiveLock);
 
-   partRel = heap_openrv(name, ShareUpdateExclusiveLock);
+   partRel = table_openrv(name, ShareUpdateExclusiveLock);
 
    /* All inheritance related checks are performed within the function */
    RemoveInheritance(partRel, rel);
 
    /* Update pg_class tuple */
-   classRel = heap_open(RelationRelationId, RowExclusiveLock);
+   classRel = table_open(RelationRelationId, RowExclusiveLock);
    tuple = SearchSysCacheCopy1(RELOID,
                                ObjectIdGetDatum(RelationGetRelid(partRel)));
    if (!HeapTupleIsValid(tuple))
@@ -15072,7 +15072,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
        update_relispartition(classRel, idxid, false);
        index_close(idx, NoLock);
    }
-   heap_close(classRel, RowExclusiveLock);
+   table_close(classRel, RowExclusiveLock);
 
    /* Detach foreign keys */
    fks = copyObject(RelationGetFKeyList(partRel));
@@ -15100,7 +15100,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
    ObjectAddressSet(address, RelationRelationId, RelationGetRelid(partRel));
 
    /* keep our lock until commit */
-   heap_close(partRel, NoLock);
+   table_close(partRel, NoLock);
 
    return address;
 }
@@ -15333,7 +15333,7 @@ refuseDupeIndexAttach(Relation parentIdx, Relation partIdx, Relation partitionTb
    HeapTuple   tuple;
    SysScanDesc scan;
 
-   pg_inherits = heap_open(InheritsRelationId, AccessShareLock);
+   pg_inherits = table_open(InheritsRelationId, AccessShareLock);
    ScanKeyInit(&key, Anum_pg_inherits_inhparent,
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(parentIdx)));
@@ -15357,7 +15357,7 @@ refuseDupeIndexAttach(Relation parentIdx, Relation partIdx, Relation partitionTb
    }
 
    systable_endscan(scan);
-   heap_close(pg_inherits, AccessShareLock);
+   table_close(pg_inherits, AccessShareLock);
 }
 
 /*
@@ -15383,7 +15383,7 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
     * (verifying the pg_index entry for each), and if we reach the total
     * amount we expect, we can mark this parent index as valid.
     */
-   inheritsRel = heap_open(InheritsRelationId, AccessShareLock);
+   inheritsRel = table_open(InheritsRelationId, AccessShareLock);
    ScanKeyInit(&key, Anum_pg_inherits_inhparent,
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(partedIdx)));
@@ -15408,7 +15408,7 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
 
    /* Done with pg_inherits */
    systable_endscan(scan);
-   heap_close(inheritsRel, AccessShareLock);
+   table_close(inheritsRel, AccessShareLock);
 
    /*
     * If we found as many inherited indexes as the partitioned table has
@@ -15419,7 +15419,7 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
        Relation    idxRel;
        HeapTuple   newtup;
 
-       idxRel = heap_open(IndexRelationId, RowExclusiveLock);
+       idxRel = table_open(IndexRelationId, RowExclusiveLock);
 
        newtup = heap_copytuple(partedIdx->rd_indextuple);
        ((Form_pg_index) GETSTRUCT(newtup))->indisvalid = true;
@@ -15427,7 +15427,7 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
 
        CatalogTupleUpdate(idxRel, &partedIdx->rd_indextuple->t_self, newtup);
 
-       heap_close(idxRel, RowExclusiveLock);
+       table_close(idxRel, RowExclusiveLock);
    }
 
    /*
@@ -15473,7 +15473,7 @@ update_relispartition(Relation classRel, Oid relationId, bool newval)
 
    if (classRel == NULL)
    {
-       classRel = heap_open(RelationRelationId, RowExclusiveLock);
+       classRel = table_open(RelationRelationId, RowExclusiveLock);
        opened = true;
    }
 
@@ -15486,5 +15486,5 @@ update_relispartition(Relation classRel, Oid relationId, bool newval)
    ReleaseSysCache(tup);
 
    if (opened)
-       heap_close(classRel, RowExclusiveLock);
+       table_close(classRel, RowExclusiveLock);
 }
index 946e1b99767b2ee58790c188fbbebcc044b29a47..f5ad9f7becc018769329604e584433197b00f304 100644 (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;
 }
index 5103f30c8f84d164a0aaad4db81d3043e3536fb3..8f02db9ddb448cfa2f74ed45aa36216ad6f38434 100644 (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
index 3f727f2744cc615a1826100598aca9a57ad77bf1..d812413864ff8a38d4912ab88b58072883618f24 100644 (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);
 
index 9ca30b0443ce1d479d6bfb16e2170c04e97f694a..35a6485118fb2e77fdcb1c197d8d6ce0037b3336 100644 (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);
 
index 938c7d0ed0a3fc6f060d951d435cde64da3a8ed6..34c81d5c04039977221672d9b1633b452558fd9f 100644 (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);
 }
index c4522cdc080fce515225f46f127b2d29663495e9..eaee8ec1ff6720fa0c2a55290f67a9735a2915d1 100644 (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;
index ed0330056bfb5e4f3889cbcf1e6a5ca213afbf72..8ac4e56ce80992cd0cbc8303273b2e154b106e7c 100644 (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 */
index 93e4b287970803f8f895a8e1f8549facc063a369..2a7bc015630819fe87ff365997618ed1240dccea 100644 (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);
    }
 }
 
index 146ca6e053291605dce996b3dfedef19f2680fbf..312a0dc8056c56c6846c64a982f357895b3f80fe 100644 (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;
index cce762515d7ed9b751d5369033497a3e28e6fad8..4465f002c8f3a9b6d340a8179fa1660fdb2e72be 100644 (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;
 }
index 8d9315a45473ebac7df5ffbfe700912892dd7c04..0e045f171afbedd2866cb80ed2f7c24ecbdeafc1 100644 (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;
 }
index 9be76440c16083b0b3c63126da353c1f1894a685..eaf788e578d1538c0aaea6107905fac2ec4e2e95 100644 (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);
    }
 }
 
index a6029f5637317ad04324a7d32123aed1c4bfa237..ab35055c596a6d2e29520dd41760caeb00eb13c4 100644 (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;
 }
 
index 2d740b5f52c3f112eb4ca1762e07daa5d6d6698b..8805543da749a1036b51880f0e4b590532ca8cf1 100644 (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,
index 0562e6ecc8033223c7ffcdb912364a5f9ae3edd5..ece81697e6a677d5be74a2f369d729fd254e85e0 100644 (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);
 }
index 0f8175d39f31d56ba169d20b9b20bd308a325ccc..09fbb588af4490b3ef9d1dd9912767ab84274e1f 100644 (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;
            }
index ef3865d8ee7a7a2b72d5097e842aa99768f4974c..404569f7df402462e16ea4e8cdd3dc52a3e892c8 100644 (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);
 }
 
 
index 60993c3a7a56d4c405800a944e8b9ea83265cc7b..f21c9b32a6069042cc8298612be6420c0f55ba1e 100644 (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 */
    }
 }
 
index 4cf67873b17affbddd60798a4779e4248c7b68f3..975256ba62293136271f1dd3b66faf5f9e7b2175 100644 (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
index 13da412c59c2b1ecaf42740c666b8c7390615651..f207c35be9423532b5c3a3151d79c0a255d9a35b 100644 (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;
 }
index 2b0d889c3b7177364008f9eb1126dedb00d3abd4..55b91b5e12c4aef3ecb6d14dc45b8b0d38d472fa 100644 (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();
 
index 0ca89911844bdea467e32d9b7615e7c0c569aa0f..7a102a7ad38ace84f86aa760fb7dda492304d9a9 100644 (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);
 }
 
 
index 81087ac903373f361a37662a06b04cbe6846a077..1d918d2c428c68218442bc9ef63b9b65be6838e7 100644 (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;
 }
 
index 20ab1122064b05e2a40ce767f3338d0a362ec8a8..28f5fc23aacc6cfb563176aaa9ef732cd0e278fd 100644 (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();
index 0755f3eed80857d7dee52dedbc51597e8eac5314..2da8486e6381b2ce6ba76fde24db9ab289c385f4 100644 (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
index 0fade10268a11a37f3e607a1ba64723698b470fa..1eca69873b27d304a73fbeccce67e21100ac0cd5 100644 (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);
    }
 
    /*
index e6b4b9da28421250a85d4bd8320027880b24b7d8..4c1d9c43d0919ef2db13812a7d1bc5e2f860cdfc 100644 (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);
 }
index ec314051fa7b8ea94b98799efb840773a5bd4266..1f74c90ad7a38c79a9e3ce0e148fe195ba496467 100644 (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);
 }
 
 /*
index 26a3ca3f7b9625940a42efccfcda9dae6b462d56..835540cd334c7866444b0aa04369dd88e574d0f2 100644 (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
index 51659a51dde2f36b8797ad44aa9215e0fc149684..7f13e434a8722f4bde297b75bd3a46e9e31efe78 100644 (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);
index b0dddab47a332406dd8d5f434b9f9b984f5753a6..a8b48fd0ecc2d1a598ac3588e17a5faf4422e45e 100644 (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;
 }
index de6a08ba5555dfb58e97b22e80d0fe8d98c64eaf..3402ff860d36395315cddee6b82a398e94d335f1 100644 (file)
@@ -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 */
index 91de57e5cebdd0b380e3f8a62d5829b6bfc4e741..d330a88e3c1ecc7c5cc43eed660c02583acef054 100644 (file)
@@ -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);
index 3c18d8695c836cbed6457f072ac64b8ca8e7de5e..93399f811a5bbe8380c6efa76d58ad6140541272 100644 (file)
@@ -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
index 97eeabc8f04378661c1d167fcf734f35c56ff012..2461d7f35ee88078a75277230898f9b190866808 100644 (file)
@@ -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);
 }
 
 
index 71cfe6499ca520739824adac7aa47e8cc84b27fe..bdb7d70827932edbd5ab7386ba3e295f4c504947 100644 (file)
@@ -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);
index b016ab3c6c918041b68397a75664d885b78b78be..8097097f7bb787d51bd713ecf7430126fb2819d1 100644 (file)
@@ -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);
 }
index 7c04586ad5e6504cab712c3fff021aae48a679c5..11a5d706fd8507a4c22e45fbaf6c9ace7d7541e1 100644 (file)
@@ -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,
index 2123117f8b0ea104b913f2c856527ff0fe0ad832..231c370c6b76ed89c4aeeb9360ff7d345b8180a6 100644 (file)
@@ -938,7 +938,7 @@ CatalogCacheInitializeCache(CatCache *cache)
 
    CatalogCacheInitializeCache_DEBUG1;
 
-   relation = heap_open(cache->cc_reloid, AccessShareLock);
+   relation = table_open(cache->cc_reloid, AccessShareLock);
 
    /*
     * switch to the cache context so our allocations do not vanish at the end
@@ -965,7 +965,7 @@ CatalogCacheInitializeCache(CatCache *cache)
     */
    MemoryContextSwitchTo(oldcxt);
 
-   heap_close(relation, AccessShareLock);
+   table_close(relation, AccessShareLock);
 
    CACHE3_elog(DEBUG2, "CatalogCacheInitializeCache: %s, %d keys",
                cache->cc_relname, cache->cc_nkeys);
@@ -1357,7 +1357,7 @@ SearchCatCacheMiss(CatCache *cache,
     *
     * NOTE: it is possible for recursive cache lookups to occur while reading
     * the relation --- for example, due to shared-cache-inval messages being
-    * processed during heap_open().  This is OK.  It's even possible for one
+    * processed during table_open().  This is OK.  It's even possible for one
     * of those lookups to find and enter the very same tuple we are trying to
     * fetch here.  If that happens, we will enter a second copy of the tuple
     * into the cache.  The first copy will never be referenced again, and
@@ -1365,7 +1365,7 @@ SearchCatCacheMiss(CatCache *cache,
     * This case is rare enough that it's not worth expending extra cycles to
     * detect.
     */
-   relation = heap_open(cache->cc_reloid, AccessShareLock);
+   relation = table_open(cache->cc_reloid, AccessShareLock);
 
    scandesc = systable_beginscan(relation,
                                  cache->cc_indexoid,
@@ -1390,7 +1390,7 @@ SearchCatCacheMiss(CatCache *cache,
 
    systable_endscan(scandesc);
 
-   heap_close(relation, AccessShareLock);
+   table_close(relation, AccessShareLock);
 
    /*
     * If tuple was not found, we need to build a negative cache entry
@@ -1638,7 +1638,7 @@ SearchCatCacheList(CatCache *cache,
        cur_skey[2].sk_argument = v3;
        cur_skey[3].sk_argument = v4;
 
-       relation = heap_open(cache->cc_reloid, AccessShareLock);
+       relation = table_open(cache->cc_reloid, AccessShareLock);
 
        scandesc = systable_beginscan(relation,
                                      cache->cc_indexoid,
@@ -1705,7 +1705,7 @@ SearchCatCacheList(CatCache *cache,
 
        systable_endscan(scandesc);
 
-       heap_close(relation, AccessShareLock);
+       table_close(relation, AccessShareLock);
 
        /* Now we can build the CatCList entry. */
        oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
index ca229f940fe7359e9f76c929f2dddaf739120de1..3aa2e6e77460e067127b529961e0cc224235e276 100644 (file)
@@ -336,7 +336,7 @@ ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic)
     * without a pg_internal.init file).  The caller can also force a heap
     * scan by setting indexOK == false.
     */
-   pg_class_desc = heap_open(RelationRelationId, AccessShareLock);
+   pg_class_desc = table_open(RelationRelationId, AccessShareLock);
 
    /*
     * The caller might need a tuple that's newer than the one the historic
@@ -363,7 +363,7 @@ ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic)
 
    /* all done */
    systable_endscan(pg_class_scan);
-   heap_close(pg_class_desc, AccessShareLock);
+   table_close(pg_class_desc, AccessShareLock);
 
    return pg_class_tuple;
 }
@@ -526,7 +526,7 @@ RelationBuildTupleDesc(Relation relation)
     * built the critical relcache entries (this includes initdb and startup
     * without a pg_internal.init file).
     */
-   pg_attribute_desc = heap_open(AttributeRelationId, AccessShareLock);
+   pg_attribute_desc = table_open(AttributeRelationId, AccessShareLock);
    pg_attribute_scan = systable_beginscan(pg_attribute_desc,
                                           AttributeRelidNumIndexId,
                                           criticalRelcachesBuilt,
@@ -633,7 +633,7 @@ RelationBuildTupleDesc(Relation relation)
     * end the scan and close the attribute relation
     */
    systable_endscan(pg_attribute_scan);
-   heap_close(pg_attribute_desc, AccessShareLock);
+   table_close(pg_attribute_desc, AccessShareLock);
 
    if (need != 0)
        elog(ERROR, "catalog is missing %d attribute(s) for relid %u",
@@ -767,7 +767,7 @@ RelationBuildRuleLock(Relation relation)
     * emergency-recovery operations (ie, IgnoreSystemIndexes). This in turn
     * ensures that rules will be fired in name order.
     */
-   rewrite_desc = heap_open(RewriteRelationId, AccessShareLock);
+   rewrite_desc = table_open(RewriteRelationId, AccessShareLock);
    rewrite_tupdesc = RelationGetDescr(rewrite_desc);
    rewrite_scan = systable_beginscan(rewrite_desc,
                                      RewriteRelRulenameIndexId,
@@ -848,7 +848,7 @@ RelationBuildRuleLock(Relation relation)
     * end the scan and close the attribute relation
     */
    systable_endscan(rewrite_scan);
-   heap_close(rewrite_desc, AccessShareLock);
+   table_close(rewrite_desc, AccessShareLock);
 
    /*
     * there might not be any rules (if relhasrules is out-of-date)
@@ -1644,7 +1644,7 @@ LookupOpclassInfo(Oid operatorClassOid,
                Anum_pg_opclass_oid,
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(operatorClassOid));
-   rel = heap_open(OperatorClassRelationId, AccessShareLock);
+   rel = table_open(OperatorClassRelationId, AccessShareLock);
    scan = systable_beginscan(rel, OpclassOidIndexId, indexOK,
                              NULL, 1, skey);
 
@@ -1659,7 +1659,7 @@ LookupOpclassInfo(Oid operatorClassOid,
        elog(ERROR, "could not find tuple for opclass %u", operatorClassOid);
 
    systable_endscan(scan);
-   heap_close(rel, AccessShareLock);
+   table_close(rel, AccessShareLock);
 
    /*
     * Scan pg_amproc to obtain support procs for the opclass.  We only fetch
@@ -1679,7 +1679,7 @@ LookupOpclassInfo(Oid operatorClassOid,
                    Anum_pg_amproc_amprocrighttype,
                    BTEqualStrategyNumber, F_OIDEQ,
                    ObjectIdGetDatum(opcentry->opcintype));
-       rel = heap_open(AccessMethodProcedureRelationId, AccessShareLock);
+       rel = table_open(AccessMethodProcedureRelationId, AccessShareLock);
        scan = systable_beginscan(rel, AccessMethodProcedureIndexId, indexOK,
                                  NULL, 3, skey);
 
@@ -1697,7 +1697,7 @@ LookupOpclassInfo(Oid operatorClassOid,
        }
 
        systable_endscan(scan);
-       heap_close(rel, AccessShareLock);
+       table_close(rel, AccessShareLock);
    }
 
    opcentry->valid = true;
@@ -3348,7 +3348,7 @@ RelationSetNewRelfilenode(Relation relation, char persistence,
    /*
     * Get a writable copy of the pg_class tuple for the given relation.
     */
-   pg_class = heap_open(RelationRelationId, RowExclusiveLock);
+   pg_class = table_open(RelationRelationId, RowExclusiveLock);
 
    tuple = SearchSysCacheCopy1(RELOID,
                                ObjectIdGetDatum(RelationGetRelid(relation)));
@@ -3402,7 +3402,7 @@ RelationSetNewRelfilenode(Relation relation, char persistence,
 
    heap_freetuple(tuple);
 
-   heap_close(pg_class, RowExclusiveLock);
+   table_close(pg_class, RowExclusiveLock);
 
    /*
     * Make the pg_class row change visible, as well as the relation map
@@ -3938,7 +3938,7 @@ AttrDefaultFetch(Relation relation)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(relation)));
 
-   adrel = heap_open(AttrDefaultRelationId, AccessShareLock);
+   adrel = table_open(AttrDefaultRelationId, AccessShareLock);
    adscan = systable_beginscan(adrel, AttrDefaultIndexId, true,
                                NULL, 1, &skey);
    found = 0;
@@ -3983,7 +3983,7 @@ AttrDefaultFetch(Relation relation)
    }
 
    systable_endscan(adscan);
-   heap_close(adrel, AccessShareLock);
+   table_close(adrel, AccessShareLock);
 }
 
 /*
@@ -4005,7 +4005,7 @@ CheckConstraintFetch(Relation relation)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(relation)));
 
-   conrel = heap_open(ConstraintRelationId, AccessShareLock);
+   conrel = table_open(ConstraintRelationId, AccessShareLock);
    conscan = systable_beginscan(conrel, ConstraintRelidTypidNameIndexId, true,
                                 NULL, 1, skey);
 
@@ -4046,7 +4046,7 @@ CheckConstraintFetch(Relation relation)
    }
 
    systable_endscan(conscan);
-   heap_close(conrel, AccessShareLock);
+   table_close(conrel, AccessShareLock);
 
    if (found != ncheck)
        elog(ERROR, "%d constraint record(s) missing for rel %s",
@@ -4117,7 +4117,7 @@ RelationGetFKeyList(Relation relation)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(relation)));
 
-   conrel = heap_open(ConstraintRelationId, AccessShareLock);
+   conrel = table_open(ConstraintRelationId, AccessShareLock);
    conscan = systable_beginscan(conrel, ConstraintRelidTypidNameIndexId, true,
                                 NULL, 1, &skey);
 
@@ -4146,7 +4146,7 @@ RelationGetFKeyList(Relation relation)
    }
 
    systable_endscan(conscan);
-   heap_close(conrel, AccessShareLock);
+   table_close(conrel, AccessShareLock);
 
    /* Now save a copy of the completed list in the relcache entry. */
    oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -4224,7 +4224,7 @@ RelationGetIndexList(Relation relation)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(relation)));
 
-   indrel = heap_open(IndexRelationId, AccessShareLock);
+   indrel = table_open(IndexRelationId, AccessShareLock);
    indscan = systable_beginscan(indrel, IndexIndrelidIndexId, true,
                                 NULL, 1, &skey);
 
@@ -4265,7 +4265,7 @@ RelationGetIndexList(Relation relation)
 
    systable_endscan(indscan);
 
-   heap_close(indrel, AccessShareLock);
+   table_close(indrel, AccessShareLock);
 
    /* Now save a copy of the completed list in the relcache entry. */
    oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -4340,7 +4340,7 @@ RelationGetStatExtList(Relation relation)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(RelationGetRelid(relation)));
 
-   indrel = heap_open(StatisticExtRelationId, AccessShareLock);
+   indrel = table_open(StatisticExtRelationId, AccessShareLock);
    indscan = systable_beginscan(indrel, StatisticExtRelidIndexId, true,
                                 NULL, 1, &skey);
 
@@ -4353,7 +4353,7 @@ RelationGetStatExtList(Relation relation)
 
    systable_endscan(indscan);
 
-   heap_close(indrel, AccessShareLock);
+   table_close(indrel, AccessShareLock);
 
    /* Now save a copy of the completed list in the relcache entry. */
    oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
@@ -4907,7 +4907,7 @@ RelationGetExclusionInfo(Relation indexRelation,
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(indexRelation->rd_index->indrelid));
 
-   conrel = heap_open(ConstraintRelationId, AccessShareLock);
+   conrel = table_open(ConstraintRelationId, AccessShareLock);
    conscan = systable_beginscan(conrel, ConstraintRelidTypidNameIndexId, true,
                                 NULL, 1, skey);
    found = false;
@@ -4951,7 +4951,7 @@ RelationGetExclusionInfo(Relation indexRelation,
    }
 
    systable_endscan(conscan);
-   heap_close(conrel, AccessShareLock);
+   table_close(conrel, AccessShareLock);
 
    if (!found)
        elog(ERROR, "exclusion constraint record missing for rel %s",
index b766dbb21c086a002fb8c9de7430cc4419db2274..c506dc9dec4243db376d6acd82a1a99ecddd9077 100644 (file)
@@ -192,7 +192,7 @@ RelidByRelfilenode(Oid reltablespace, Oid relfilenode)
         */
 
        /* check for plain relations by looking in pg_class */
-       relation = heap_open(RelationRelationId, AccessShareLock);
+       relation = table_open(RelationRelationId, AccessShareLock);
 
        /* copy scankey to local copy, it will be modified during the scan */
        memcpy(skey, relfilenode_skey, sizeof(skey));
@@ -226,7 +226,7 @@ RelidByRelfilenode(Oid reltablespace, Oid relfilenode)
        }
 
        systable_endscan(scandesc);
-       heap_close(relation, AccessShareLock);
+       table_close(relation, AccessShareLock);
 
        /* check for tables that are mapped but not shared */
        if (!found)
index 4e0fdb7b55a4cf5abd481f844a1183039e6d7fad..417c494cd053d278a64bfc4fea2f753ff5f5916a 100644 (file)
@@ -481,7 +481,7 @@ lookup_ts_config_cache(Oid cfgId)
                    BTEqualStrategyNumber, F_OIDEQ,
                    ObjectIdGetDatum(cfgId));
 
-       maprel = heap_open(TSConfigMapRelationId, AccessShareLock);
+       maprel = table_open(TSConfigMapRelationId, AccessShareLock);
        mapidx = index_open(TSConfigMapIndexId, AccessShareLock);
        mapscan = systable_beginscan_ordered(maprel, mapidx,
                                             NULL, 1, &mapskey);
@@ -522,7 +522,7 @@ lookup_ts_config_cache(Oid cfgId)
 
        systable_endscan_ordered(mapscan);
        index_close(mapidx, AccessShareLock);
-       heap_close(maprel, AccessShareLock);
+       table_close(maprel, AccessShareLock);
 
        if (ndicts > 0)
        {
index b1931dad95ebf5fa110772d7af0159cfe2fc5788..bca2dc118d96dc87fd51f0cea058a0d78979ab20 100644 (file)
@@ -915,7 +915,7 @@ load_domaintype_info(TypeCacheEntry *typentry)
     * constraints for not just this domain, but any ancestor domains, so the
     * outer loop crawls up the domain stack.
     */
-   conRel = heap_open(ConstraintRelationId, AccessShareLock);
+   conRel = table_open(ConstraintRelationId, AccessShareLock);
 
    for (;;)
    {
@@ -1056,7 +1056,7 @@ load_domaintype_info(TypeCacheEntry *typentry)
        ReleaseSysCache(tup);
    }
 
-   heap_close(conRel, AccessShareLock);
+   table_close(conRel, AccessShareLock);
 
    /*
     * Only need to add one NOT NULL check regardless of how many domains in
@@ -2347,7 +2347,7 @@ load_enum_cache_data(TypeCacheEntry *tcache)
                BTEqualStrategyNumber, F_OIDEQ,
                ObjectIdGetDatum(tcache->type_id));
 
-   enum_rel = heap_open(EnumRelationId, AccessShareLock);
+   enum_rel = table_open(EnumRelationId, AccessShareLock);
    enum_scan = systable_beginscan(enum_rel,
                                   EnumTypIdLabelIndexId,
                                   true, NULL,
@@ -2368,7 +2368,7 @@ load_enum_cache_data(TypeCacheEntry *tcache)
    }
 
    systable_endscan(enum_scan);
-   heap_close(enum_rel, AccessShareLock);
+   table_close(enum_rel, AccessShareLock);
 
    /* Sort the items into OID order */
    qsort(items, numitems, sizeof(EnumItem), enum_oid_cmp);
index 7415c4faabc8d6cc3147d37884ab5ff25b98b836..5dc1d99f78e76d16ddc8689476ac70e34c9b31d6 100644 (file)
@@ -113,7 +113,7 @@ GetDatabaseTuple(const char *dbname)
     * built the critical shared relcache entries (i.e., we're starting up
     * without a shared relcache cache file).
     */
-   relation = heap_open(DatabaseRelationId, AccessShareLock);
+   relation = table_open(DatabaseRelationId, AccessShareLock);
    scan = systable_beginscan(relation, DatabaseNameIndexId,
                              criticalSharedRelcachesBuilt,
                              NULL,
@@ -127,7 +127,7 @@ GetDatabaseTuple(const char *dbname)
 
    /* all done */
    systable_endscan(scan);
-   heap_close(relation, AccessShareLock);
+   table_close(relation, AccessShareLock);
 
    return tuple;
 }
@@ -156,7 +156,7 @@ GetDatabaseTupleByOid(Oid dboid)
     * built the critical shared relcache entries (i.e., we're starting up
     * without a shared relcache cache file).
     */
-   relation = heap_open(DatabaseRelationId, AccessShareLock);
+   relation = table_open(DatabaseRelationId, AccessShareLock);
    scan = systable_beginscan(relation, DatabaseOidIndexId,
                              criticalSharedRelcachesBuilt,
                              NULL,
@@ -170,7 +170,7 @@ GetDatabaseTupleByOid(Oid dboid)
 
    /* all done */
    systable_endscan(scan);
-   heap_close(relation, AccessShareLock);
+   table_close(relation, AccessShareLock);
 
    return tuple;
 }
@@ -1158,7 +1158,7 @@ process_settings(Oid databaseid, Oid roleid)
    if (!IsUnderPostmaster)
        return;
 
-   relsetting = heap_open(DbRoleSettingRelationId, AccessShareLock);
+   relsetting = table_open(DbRoleSettingRelationId, AccessShareLock);
 
    /* read all the settings under the same snapshot for efficiency */
    snapshot = RegisterSnapshot(GetCatalogSnapshot(DbRoleSettingRelationId));
@@ -1170,7 +1170,7 @@ process_settings(Oid databaseid, Oid roleid)
    ApplySetting(snapshot, InvalidOid, InvalidOid, relsetting, PGC_S_GLOBAL);
 
    UnregisterSnapshot(snapshot);
-   heap_close(relsetting, AccessShareLock);
+   table_close(relsetting, AccessShareLock);
 }
 
 /*
@@ -1250,13 +1250,13 @@ ThereIsAtLeastOneRole(void)
    HeapScanDesc scan;
    bool        result;
 
-   pg_authid_rel = heap_open(AuthIdRelationId, AccessShareLock);
+   pg_authid_rel = table_open(AuthIdRelationId, AccessShareLock);
 
    scan = heap_beginscan_catalog(pg_authid_rel, 0, NULL);
    result = (heap_getnext(scan, ForwardScanDirection) != NULL);
 
    heap_endscan(scan);
-   heap_close(pg_authid_rel, AccessShareLock);
+   table_close(pg_authid_rel, AccessShareLock);
 
    return result;
 }
index 165e819e47a25ccd072bb828a8bcb7de4f3d34e5..25001600282364d097da0e9859434da77201b2e7 100644 (file)
@@ -135,9 +135,9 @@ ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd)
    {
        Relation    relation;
 
-       relation = heap_open(enrmd->reliddesc, NoLock);
+       relation = table_open(enrmd->reliddesc, NoLock);
        tupdesc = relation->rd_att;
-       heap_close(relation, NoLock);
+       table_close(relation, NoLock);
    }
 
    return tupdesc;