On Sat, Oct 31, 2026 at 01:34:16PM +0000, Greg Burd wrote:
> That comment was badly worded, and I think it's what sent you down this
> path. The stores don't free it; the explicit pfree() after each store
> does. And we don't have trouble anyway, because each branch copies the
> data out before freeing it: heap_copytuple() in the buffer branch and
> ExecMaterializeSlot() in the virtual one. The slot is fine. Only the
> original tuple is gone, and t_self is the one thing we still read from
> it.
> 
> So I'd keep the local copy and fix the comment so it gives the actual
> reason, something like:
> 
>      /*
>       * Set the slot's TID from the tuple.  ExecClearTuple() reset it, and
>       * only the heap-slot branch above stores a new one.  Use the copy taken
>       * on entry, because the branches above free the tuple when
>       * shouldFree is true.
>       */
>      slot->tts_tid = tid;
> 
> Nathan, please adjust the wording however you like when you commit.

Heikki, WDYT?  I was similarly confused by the comment, and my attempts at
better phrasing obviously fell short.

-- 
nathan


Reply via email to