From 576c596d20c67a92713da971e01a2b567901b76d Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Wed, 11 Mar 2026 14:14:57 +0800 Subject: [PATCH v1] heapam_handler: remove unused tuple fetch in speculative completion heapam_tuple_complete_speculative() fetched a tuple from the slot only to free it immediately afterwards, without ever using it. The function only needs slot->tts_tid to complete or abort the speculative insertion, so remove the unnecessary fetch and pfree(). Author: Chao Li Reviewed-by: Discussion: https://postgr.es/m/ --- src/backend/access/heap/heapam_handler.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 253a735b6c1..f0e2be3e85d 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -12,7 +12,7 @@ * * * NOTES - * This files wires up the lower level heapam.c et al routines with the + * This file wires up the lower level heapam.c et al routines with the * tableam abstraction. * *------------------------------------------------------------------------- @@ -295,17 +295,11 @@ static void heapam_tuple_complete_speculative(Relation relation, TupleTableSlot *slot, uint32 specToken, bool succeeded) { - bool shouldFree = true; - HeapTuple tuple = ExecFetchSlotHeapTuple(slot, true, &shouldFree); - /* adjust the tuple's state accordingly */ if (succeeded) heap_finish_speculative(relation, &slot->tts_tid); else heap_abort_speculative(relation, &slot->tts_tid); - - if (shouldFree) - pfree(tuple); } static TM_Result -- 2.50.1 (Apple Git-155)