Skip to content

Commit d1d416c

Browse files
committed
Swap relallfrozen when swapping relation files
When swapping the physical files of two relations we copy the size statistics from one relation to the other, but we missed the count of all-frozen pages that was added in PostgreSQL 18. Swap it too so the statistics stay correct after the swap.
1 parent 0a51c86 commit d1d416c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/import/heapswap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ ts_swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class, bool swap_toast_
258258
swap_allvisible = relform1->relallvisible;
259259
relform1->relallvisible = relform2->relallvisible;
260260
relform2->relallvisible = swap_allvisible;
261+
262+
#if PG18_GE
263+
int32 swap_allfrozen;
264+
265+
swap_allfrozen = relform1->relallfrozen;
266+
relform1->relallfrozen = relform2->relallfrozen;
267+
relform2->relallfrozen = swap_allfrozen;
268+
#endif
261269
}
262270

263271
/*

0 commit comments

Comments
 (0)