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:
11
src/backend/utils/cache/relcache.c
vendored
11
src/backend/utils/cache/relcache.c
vendored
@ -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 */
|
||||
|
||||
|
2
src/backend/utils/cache/relmapper.c
vendored
2
src/backend/utils/cache/relmapper.c
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user