Re: Two issues with version checks in CREATE SUBSCRIPTION

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Two issues with version checks in CREATE SUBSCRIPTION
Date: 2025-12-23 04:51:16
Message-ID: CAA4eK1KFUz+7nSXJsn9TxoWukVgceaU93Be=+E+ZV+4vA1a1yA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 22, 2025 at 10:57 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> While looking at subscription-related code, I noticed two issues related to
> version checks.
>
> if (walrcv_server_version(wrconn) < 19000)
> ereport(ERROR,
> errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> errmsg("cannot enable retain_dead_tuples if the
> publisher is running a version earlier than PostgreSQL 19"));
>
> First, in subscriptioncmds.c this check rejects enabling retain_dead_tuples
> when the publisher is running an older version. However, the comparison uses
> 19000 as v19 value. Since server versions are encoded as 190000 for v19,
> this appears to be a typo and allows the option to be enabled unexpectedly
> on pre-v19 publishers. The attached 0001 patch fixes this by correcting
> the version constant.
>
> Second, CREATE SUBSCRIPTION with copy_data=true and origin='none' currently
> fails when the publisher is running a version earlier than v19, although
> this combination should be supported. The failure occurs because the command
> issues a query calling pg_get_publication_sequences on the publisher,
> which does not exist before v19. The attached 0002 patch fixes this
> by skipping that query when the publisher runs an older version.
>

The changes look good to me though I haven't tested the patches. So,
please feel free to push after the relevant test. Thanks for catching
and fixing these issues.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-12-23 05:05:32 Re: Allow GUC settings in CREATE SUBSCRIPTION CONNECTION to take effect
Previous Message Amit Kapila 2025-12-23 04:21:15 Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber