agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix logical decoding to ignore updates without a new tuple.
Date: Fri, 11 Sep 2026 17:55:13 +0000
Message-ID: <E1x55Sy-00000004T2k-2xt4@gemulon.postgresql.org> (raw)

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@linux.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/3a3524e9acf4b22e7b3100a3710be3adffe89874

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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1x55Sy-00000004T2k-2xt4@gemulon.postgresql.org>
Permalink:  ../E1x55Sy-00000004T2k-2xt4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x55Sy-00000004T2k-2xt4@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 logical decoding to ignore updates without a new tuple.
  In-Reply-To: <E1x55Sy-00000004T2k-2xt4@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