1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Avoid index rebuild for no-rewrite ALTER TABLE .. ALTER TYPE.

Noah Misch.  Review and minor cosmetic changes by me.
This commit is contained in:
Robert Haas
2011-07-18 11:02:48 -04:00
parent 8f8a273c4d
commit 367bc426a1
20 changed files with 348 additions and 53 deletions

View File

@ -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 */

View File

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