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 <[email protected]>
Reviewed-by: Noah Misch <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

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

Reply via email to