pgsql: Fix tablesync failure for partitioned tables on older publishers

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix tablesync failure for partitioned tables on older publishers
Date: 2026-09-08 18:14:28
Message-ID: E1x40Kx-000000041eX-0Jo8@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix tablesync failure for partitioned tables on older publishers.

Commit 266543a made initial table synchronization use "COPY table TO"
for a partitioned table, but decided that from the relation kind
alone. A partitioned table is only accepted there since v19, so a v19
subscriber replicating from an older publisher with
publish_via_partition_root failed at table sync.

Check the publisher version, and fall back to the "COPY (SELECT ...)
TO" variant otherwise.

Backpatch to v19, where 266543a changed the initial table
synchronization.

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/20260905040020.57.noahmisch@microsoft.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/11fb89fdbd319a53e32dce77685118979cafac0e

Modified Files
--------------
src/backend/replication/logical/tablesync.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-08 18:14:33 pgsql: Fix tablesync failure for partitioned tables on older publishers
Previous Message Robert Haas 2026-09-08 15:08:21 pgsql: pg_stash_advice: Fix failure to reload empty advice string.