pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix missing tts_tid assignments in ExecForceStoreHeapTuple().
Date: Mon, 02 Nov 2026 16:15:06 +0000
Message-ID: <E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org> (raw)

Fix missing tts_tid assignments in ExecForceStoreHeapTuple().

ExecForceStoreHeapTuple() clears the slot before storing the tuple,
which invalidates the slot's TID, but it only sets the TID again
for slots of type TTSOpsHeapTuple.  Besides producing wrong query
results, this can lead to data corruption if an affected tuple is
locked (e.g., via SELECT ... FOR UPDATE).  To fix, set the slot's
TID for the other kinds of slots, too.

Oversight in commit b8d71745ea.

Author: Virender Singla <virender.cse@gmail.com>
Co-authored-by: Greg Burd <greg@burd.me>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Nikolay Samokhvalov <nik@postgres.ai>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Tested-by: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAM6Zo8wZOLnCWRO_tuuXVX9J4N4JN6GsEnk8WJtT0%3D_0zy-1dw%40mail.gmail.com
Discussion: https://postgr.es/m/0498c10f-839b-4f68-9994-c29b454e55a4%40app.fastmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c5c36ae6f4965a1e5cba9347c5292ebf0d7587f8

Modified Files
--------------
src/backend/executor/execTuples.c | 2 ++
1 file changed, 2 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org>
Permalink:  ../E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org
  Subject: Re: pgsql: Fix missing tts_tid assignments in ExecForceStoreHeapTuple().
  In-Reply-To: <E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org>
  References: <E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox