On 30/10/2026 18:11, Nathan Bossart wrote:
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -1752,6 +1752,8 @@ ExecForceStoreHeapTuple(HeapTuple tuple,
TupleTableSlot *slot,
bool shouldFree)
{
+ ItemPointerData tid = tuple->t_self;
+
if (TTS_IS_HEAPTUPLE(slot))
{
ExecStoreHeapTuple(tuple, slot, shouldFree);
@@ -1784,6 +1786,13 @@ ExecForceStoreHeapTuple(HeapTuple tuple,
pfree(tuple);
}
}
+
+ /*
+ * ExecClearTuple() invalidated the slot's TID, so we need to set it
again
+ * here. Note that the tuple might have already been freed, so we use
the
+ * copy of its TID that we saved above.
+ */
+ slot->tts_tid = tid;
}
/*
The comment sounds wrong to me. This isn't restoring the old TID that
was in the slot previously, it's setting the new TID from 'tuple'. Or am
I missing something?
For same reason, the local variable seems pointless; you could just do:
slot->tts_tid = tuple->t_self;
The comment in Greg's earlier version (v9) said:
+ /*
+ * Store the TID from the local copy taken on entry since the stores
above
+ * may have freed the tuple.
+ */
+ slot->tts_tid = tid;
But I don't see how the store might've free'd the tuple. If it did, we'd
have trouble anyway.
- Heikki