From 367bc426a1c22b9f6badb06cd41fc438fd034639 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Mon, 18 Jul 2011 11:02:48 -0400 Subject: Avoid index rebuild for no-rewrite ALTER TABLE .. ALTER TYPE. Noah Misch. Review and minor cosmetic changes by me. --- src/backend/utils/cache/relcache.c | 11 +++++------ src/backend/utils/cache/relmapper.c | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/backend/utils/cache') diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 0b9d77a61d2..809222bfe95 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -2395,6 +2395,7 @@ RelationBuildLocalRelation(const char *relname, Oid relnamespace, TupleDesc tupDesc, Oid relid, + Oid relfilenode, Oid reltablespace, bool shared_relation, bool mapped_relation, @@ -2529,10 +2530,8 @@ RelationBuildLocalRelation(const char *relname, /* * Insert relation physical and logical identifiers (OIDs) into the right - * places. Note that the physical ID (relfilenode) is initially the same - * as the logical ID (OID); except that for a mapped relation, we set - * relfilenode to zero and rely on RelationInitPhysicalAddr to consult the - * map. + * places. For a mapped relation, we set relfilenode to zero and rely on + * RelationInitPhysicalAddr to consult the map. */ rel->rd_rel->relisshared = shared_relation; @@ -2547,10 +2546,10 @@ RelationBuildLocalRelation(const char *relname, { rel->rd_rel->relfilenode = InvalidOid; /* Add it to the active mapping information */ - RelationMapUpdateMap(relid, relid, shared_relation, true); + RelationMapUpdateMap(relid, relfilenode, shared_relation, true); } else - rel->rd_rel->relfilenode = relid; + rel->rd_rel->relfilenode = relfilenode; RelationInitLockInfo(rel); /* see lmgr.c */ diff --git a/src/backend/utils/cache/relmapper.c b/src/backend/utils/cache/relmapper.c index a19ee28b53b..b04dc9e3497 100644 --- a/src/backend/utils/cache/relmapper.c +++ b/src/backend/utils/cache/relmapper.c @@ -792,7 +792,7 @@ write_relmap_file(bool shared, RelMapFile *newmap, rnode.spcNode = tsid; rnode.dbNode = dbid; rnode.relNode = newmap->mappings[i].mapfilenode; - RelationPreserveStorage(rnode); + RelationPreserveStorage(rnode, false); } } -- cgit v1.2.3