On 20.11.25 18:19, Melanie Plageman wrote:
+ prstate->deadoffsets = (OffsetNumber *) presult->deadoffsets;
In your patch
v22-0001-Split-heap_page_prune_and_freeze-into-helpers.patch, the
assignment above casts away the const qualification of the function
argument presult:
+static void
+prune_freeze_setup(PruneFreezeParams *params,
+ TransactionId new_relfrozen_xid,
+ MultiXactId new_relmin_mxid,
+ const PruneFreezeResult *presult,
+ PruneState *prstate)
(The cast is otherwise unnecessary, since the underlying type is the
same on both sides.)
Since prstate->deadoffsets is in fact later modified, this makes the
original const qualification invalid.
I suggest the attached patch to remove the faulty const qualification
and the then-unnecessary cast.
From 336aa87add1a85aca84d8ca751c4187a08aa9d7f Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Sat, 13 Dec 2025 14:45:08 +0100
Subject: [PATCH] Fix const qualification in prune_freeze_setup()
The const qualification of the presult argument is later cast away, so
it was not correct.
---
src/backend/access/heap/pruneheap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/backend/access/heap/pruneheap.c
b/src/backend/access/heap/pruneheap.c
index ca44225a10e..4eb49380b92 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -160,7 +160,7 @@ typedef struct
static void prune_freeze_setup(PruneFreezeParams *params,
TransactionId
*new_relfrozen_xid,
MultiXactId
*new_relmin_mxid,
- const
PruneFreezeResult *presult,
+ PruneFreezeResult
*presult,
PruneState *prstate);
static void prune_freeze_plan(Oid reloid, Buffer buffer,
PruneState *prstate,
@@ -327,7 +327,7 @@ static void
prune_freeze_setup(PruneFreezeParams *params,
TransactionId *new_relfrozen_xid,
MultiXactId *new_relmin_mxid,
- const PruneFreezeResult *presult,
+ PruneFreezeResult *presult,
PruneState *prstate)
{
/* Copy parameters to prstate */
@@ -382,7 +382,7 @@ prune_freeze_setup(PruneFreezeParams *params,
prstate->recently_dead_tuples = 0;
prstate->hastup = false;
prstate->lpdead_items = 0;
- prstate->deadoffsets = (OffsetNumber *) presult->deadoffsets;
+ prstate->deadoffsets = presult->deadoffsets;
prstate->frz_conflict_horizon = InvalidTransactionId;
/*
--
2.52.0