From 4fb942f85b24cd8c70541855c3cddc4b62ea91c1 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 23 Dec 2025 00:58:22 +0900 Subject: [PATCH v1 2/2] Avoid calling pg_get_publication_sequences on pre-PG19 publishers. CREATE SUBSCRIPTION with copy_data=true and origin='none' previously failed when the publisher was running a version earlier than PostgreSQL 19, although this combination should be supported. The failure occurred because the command issued a query calling pg_get_publication_sequences on the publisher, which is not available before PG19. Fix this by skipping that query when the publisher runs a version earlier than PostgreSQL 19. --- src/backend/commands/subscriptioncmds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index f023dcbd6ad..4e80eda0a25 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -2649,9 +2649,11 @@ check_publications_origin_sequences(WalReceiverConn *wrconn, List *publications, /* * Enable sequence synchronization checks only when origin is 'none' , to * ensure that sequence data from other origins is not inadvertently - * copied. + * copied. This check is necessary if the publisher is running PG19 or + * later, where logical replication sequence synchronization is supported. */ - if (!copydata || pg_strcasecmp(origin, LOGICALREP_ORIGIN_NONE) != 0) + if (!copydata || pg_strcasecmp(origin, LOGICALREP_ORIGIN_NONE) != 0 || + walrcv_server_version(wrconn) < 190000) return; initStringInfo(&cmd); -- 2.51.2