Skip to content

Commit

Permalink
Fix typos and don't use PG_VERSION_NUM condition
Browse files Browse the repository at this point in the history
  • Loading branch information
za-arthur committed Jan 5, 2024
1 parent bbbd008 commit 1b5daa9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,20 +1229,22 @@ swap_heap_or_index_files(Oid r1, Oid r2)
/*
* Swap relfrozenxid and relminmxid, as they must be consistent with the data
*/
swaptemp = relform1->relfrozenxid;
relform1->relfrozenxid = relform2->relfrozenxid;
relform2->relfrozenxid = swaptempxid;

#if PG_VERSION_NUM >= 90300
swaptemp = relform1->relminmxid;
relform1->relminmxid = relform2->relminmxid;
relform2->relminmxid = swaptempxid;
#endif
if (relform1->relkind != RELKIND_INDEX)
{
swaptempxid = relform1->relfrozenxid;
relform1->relfrozenxid = relform2->relfrozenxid;
relform2->relfrozenxid = swaptempxid;

swaptempxid = relform1->relminmxid;
relform1->relminmxid = relform2->relminmxid;
relform2->relminmxid = swaptempxid;
}

/* swap size statistics too, since new rel has freshly-updated stats */
{
int32 swap_pages;
float4 swap_tuples;
int32 swap_allvisible;

swap_pages = relform1->relpages;
relform1->relpages = relform2->relpages;
Expand All @@ -1252,11 +1254,9 @@ swap_heap_or_index_files(Oid r1, Oid r2)
relform1->reltuples = relform2->reltuples;
relform2->reltuples = swap_tuples;

#if PG_VERSION_NUM >= 90200
swap_pages = relform1->relallvisible;
swap_allvisible = relform1->relallvisible;
relform1->relallvisible = relform2->relallvisible;
relform2->relallvisible = swap_pages;
#endif
relform2->relallvisible = swap_allvisible;
}

indstate = CatalogOpenIndexes(relRelation);
Expand Down

0 comments on commit 1b5daa9

Please sign in to comment.