From f25968c49697db673f6cd2a07b3f7626779f1827 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Sat, 19 Oct 2019 11:18:15 +0900 Subject: [PATCH] Remove last traces of heap_open/close in the tree Since pluggable storage has been introduced, those two routines have been replaced by table_open/close, with some compatibility macros still present to allow extensions to compile correctly with v12. Some code paths using the old routines still remained, so replace them. Based on the discussion done, the consensus reached is that it is better to remove those compatibility macros so as nothing new uses the old routines, so remove also the compatibility macros. Discussion: https://postgr.es/m/20191017014706.GF5605@paquier.xyz --- src/backend/commands/statscmds.c | 4 ++-- src/backend/optimizer/util/plancat.c | 4 ++-- src/include/access/table.h | 10 ---------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index f51eb7bb64e..0ab43deb714 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -637,7 +637,7 @@ UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum, replaces[Anum_pg_statistic_ext_data_stxdmcv - 1] = true; nulls[Anum_pg_statistic_ext_data_stxdmcv - 1] = true; - rel = heap_open(StatisticExtDataRelationId, RowExclusiveLock); + rel = table_open(StatisticExtDataRelationId, RowExclusiveLock); /* replace the old tuple */ stup = heap_modify_tuple(oldtup, @@ -651,7 +651,7 @@ UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum, heap_freetuple(stup); - heap_close(rel, RowExclusiveLock); + table_close(rel, RowExclusiveLock); } /* diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index cf1761401dd..e5f9e04d659 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -2103,12 +2103,12 @@ has_stored_generated_columns(PlannerInfo *root, Index rti) bool result = false; /* Assume we already have adequate lock */ - relation = heap_open(rte->relid, NoLock); + relation = table_open(rte->relid, NoLock); tupdesc = RelationGetDescr(relation); result = tupdesc->constr && tupdesc->constr->has_generated_stored; - heap_close(relation, NoLock); + table_close(relation, NoLock); return result; } diff --git a/src/include/access/table.h b/src/include/access/table.h index 44b0af70f4e..cb9b43881b5 100644 --- a/src/include/access/table.h +++ b/src/include/access/table.h @@ -25,14 +25,4 @@ extern Relation table_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok); extern void table_close(Relation relation, LOCKMODE lockmode); -/* - * heap_ used to be the prefix for these routines, and a lot of code will just - * continue to work without adaptions after the introduction of pluggable - * storage, therefore just map these names. - */ -#define heap_open(r, l) table_open(r, l) -#define heap_openrv(r, l) table_openrv(r, l) -#define heap_openrv_extended(r, l, m) table_openrv_extended(r, l, m) -#define heap_close(r, l) table_close(r, l) - #endif /* TABLE_H */