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 <[email protected]>
Co-authored-by: Greg Burd <[email protected]>
Reviewed-by: Dilip Kumar <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Nikolay Samokhvalov <[email protected]>
Reviewed-by: Heikki Linnakangas <[email protected]>
Tested-by: Shihao Zhong <[email protected]>
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_18_STABLE

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

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

Reply via email to