pgsql: Fix logical decoding to ignore updates without a new tuple.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix logical decoding to ignore updates without a new tuple.
Date: 2026-09-11 17:55:19
Message-ID: E1x55T4-00000004T3O-0X7v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix logical decoding to ignore updates without a new tuple.

REPACK (CONCURRENTLY) suppresses logical decoding of the changes it
applies to the transient heap. For an update, suppression keeps the
tuple data out of the WAL record, but the record itself is still
written, and decoding turned it into a change carrying neither a new
nor an old tuple. An output plugin that asks for the changes made by
heap rewrites therefore outputs an UPDATE with no data at all,
reported under the name of the table being repacked.

Ignore such records, as decoding already does for inserts. Updates on
catalog relations don't carry the new tuple either, so we ignore them
too. For deletes, REPACK sets XLH_DELETE_NO_LOGICAL instead.

Backpatch to v19, where REPACK (CONCURRENTLY) was introduced.

Reported-by: Thom Brown <thom(at)linux(dot)com>
Reviewed-by: Zhijie Hou (Fujitsu) <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Discussion: https://postgr.es/m/CAA-aLv7L_-dOuHXjLh0Di66dExdOb=uTOzR=jtrqCmV0Wxyd2Q@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7ed016a1de345ffac2d54979914c61617abae4ce

Modified Files
--------------
src/backend/replication/logical/decode.c | 9 ++++
.../injection_points/expected/repack_decode.out | 48 +++++++++++++++++++++-
.../injection_points/specs/repack_decode.spec | 25 +++++++++++
3 files changed, 81 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-09-11 18:01:45 pgsql: pg_ctl: Silence warnings about unused global variables
Previous Message Masahiko Sawada 2026-09-11 17:55:13 pgsql: Fix logical decoding to ignore updates without a new tuple.