pgsql: Fix CREATE SUBSCRIPTION failure when the publisher runs on pre-P

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix CREATE SUBSCRIPTION failure when the publisher runs on pre-P
Date: 2025-12-24 14:47:04
Message-ID: E1vYQ8l-002RwE-2r@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix CREATE SUBSCRIPTION failure when the publisher runs on pre-PG19.

CREATE SUBSCRIPTION with copy_data=true and origin='none' previously
failed when the publisher was running a version earlier than PostgreSQL 19,
even though this combination should be supported.

The failure occurred because the command issued a query calling
pg_get_publication_sequences function on the publisher. That function
does not exist before PG19 and the query is only needed for logical
replication sequence synchronization, which is supported starting in PG19.

This commit fixes this issue by skipping that query when the
publisher runs a version earlier than PG19.

Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHGQGwEx4twHtJdiPWTyAXJhcBPLaH467SH2ajGSe-41m65giA@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/commands/subscriptioncmds.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-12-24 15:28:47 pgsql: doc: Use proper tags in pg_overexplain documentation.
Previous Message Fujii Masao 2025-12-24 14:25:50 pgsql: Fix version check for retain_dead_tuples subscription option.