agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix heap_update() ignoring TABLE_UPDATE_NO_LOGICAL for TOAST tup
Date: Fri, 11 Sep 2026 17:21:56 +0000
Message-ID: <E1x54wl-00000004SmR-33ck@gemulon.postgresql.org> (raw)
Fix heap_update() ignoring TABLE_UPDATE_NO_LOGICAL for TOAST tuples.
Previously, heap_update() honored TABLE_UPDATE_NO_LOGICAL for the main
tuple but passed a hardcoded 0 to the tuple toaster, so the tuples it
wrote to the TOAST relation were logged for decoding anyway. That was
harmless until commit 28d534e2ae0a gave updates the flag; the insert
path has propagated its own ever since suppression was introduced for
heap rewrites.
REPACK (CONCURRENTLY), the only user of the flag, relies on it to keep
the changes it applies to the transient heap out of the logical
stream. Logical decoding therefore reassembled the TOAST value and
then dereferenced a new tuple that the suppressed record doesn't
carry, crashing the backend. This is reachable only if an output
plugin asks for the changes made by heap rewrites. In core that is
just test_decoding with include-rewrites.
Fix this by passing HEAP_INSERT_NO_LOGICAL down to the tuple toaster
when TABLE_UPDATE_NO_LOGICAL is set.
Backpatch to v19, where REPACK (CONCURRENTLY) was introduced.
Reported-by: Thom Brown <thom@linux.com>
Author: Antonin Houska <ah@cybertec.at>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAA-aLv7L_-dOuHXjLh0Di66dExdOb=uTOzR=jtrqCmV0Wxyd2Q@mail.gmail.com
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7164dcb6653242f757b5bdc4a26714a24207b1db
Modified Files
--------------
src/backend/access/heap/heapam.c | 8 ++-
src/test/modules/injection_points/Makefile | 3 ++
.../injection_points/expected/repack_decode.out | 36 +++++++++++++
src/test/modules/injection_points/meson.build | 1 +
.../injection_points/specs/repack_decode.spec | 60 ++++++++++++++++++++++
5 files changed, 106 insertions(+), 2 deletions(-)
view thread (2+ messages) latest in thread
Message-ID: <E1x54wl-00000004SmR-33ck@gemulon.postgresql.org>
Permalink: ../E1x54wl-00000004SmR-33ck@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x54wl-00000004SmR-33ck@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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix heap_update() ignoring TABLE_UPDATE_NO_LOGICAL for TOAST tup
In-Reply-To: <E1x54wl-00000004SmR-33ck@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox