Re: [PATCH] Corruption Issue: Fix missing tts_tid in ExecForceStoreHeapTuple

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Greg Burd <greg(at)burd(dot)me>
Cc: hlinnaka(at)iki(dot)fi, zhong950419(at)gmail(dot)com, andres(at)anarazel(dot)de, nik(at)postgres(dot)ai, virender(dot)cse(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, michael(at)paquier(dot)xyz, dilipbalaut(at)gmail(dot)com
Subject: Re: [PATCH] Corruption Issue: Fix missing tts_tid in ExecForceStoreHeapTuple
Date: 2026-11-02 14:20:42
Message-ID: auicOpXQomrM0pwr@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Chalke 2026-11-02 14:20:56 Re: PL/pgSQL: apply the too_many_rows extra check to EXECUTE ... INTO
Previous Message Guillaume Lelarge 2026-11-02 14:20:27 Re: Setting the number of digits after the decimal point with a psql's pset variable