pgsql: Fix missing tts_tid assignments in ExecForceStoreHeapTuple().

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix missing tts_tid assignments in ExecForceStoreHeapTuple().
Date: 2026-11-02 16:15:06
Message-ID: E1xNugc-00000001oUL-3hXc@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)cse(at)gmail(dot)com>
Co-authored-by: Greg Burd <greg(at)burd(dot)me>
Reviewed-by: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Tested-by: Shihao Zhong <zhong950419(at)gmail(dot)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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-11-02 16:59:47 pgsql: Remove unused parameters from self-join elimination functions
Previous Message Peter Eisentraut 2026-11-02 10:44:41 pgsql: Add more pg_attribute_counted_by() to various flexible array mem