From 1b5daa9b5fdf94d2eae729316a94a1b4e36e2f37 Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Fri, 5 Jan 2024 15:50:52 +0100 Subject: [PATCH] Fix typos and don't use PG_VERSION_NUM condition --- lib/repack.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/repack.c b/lib/repack.c index bf08faf..3dff816 100644 --- a/lib/repack.c +++ b/lib/repack.c @@ -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; @@ -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);