On Wed, 22 Jul 2026 at 16:16, Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Wed, Jul 22, 2026 at 8:16 AM vignesh C <vignesh21@gmail.com> wrote:
> >
> > The attached patch has the changes for the same. This patch also fixes
> > the issue reported by Kuroda-san at [1].
> >
>
> The patch used two different error codes
> (ERRCODE_FEATURE_NOT_SUPPORTED and
> ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE) for the same condition. I
> preferred to use ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE in both
> places because the error is about the remote server's state (it isn't
> new enough), not about a capability this backend fails to implement.
> That's exactly what OBJECT_NOT_IN_PREREQUISITE_STATE is for, and it's
> what the existing publisher-version guards use. OTOH,
> FEATURE_NOT_SUPPORTED reads as "PostgreSQL doesn't implement this" —
> misleading here, since sequence sync is implemented; the publisher
> just predates it.
>
> I made this change and slightly changed the comments in the patch. See attached.
Thanks for the updated patch.
I verified the following scenarios:
Scenario 1:
1. Create a logical replication setup with sequence publication on
PostgreSQL 20.
2. Change the subscription connection to point to a PostgreSQL 18 publisher.
3. Run 'ALTER SUBSCRIPTION ... REFRESH SEQUENCES'.
The command fails with expected error:
ERROR: cannot synchronize sequences if the publisher is running a
version earlier than PostgreSQL 19
Scenario 2:
1. Create a logical replication setup with sequence publication on
PostgreSQL 20, but create the subscription with 'WITH (enabled =
false)' so that the sequences remain in the INIT state in
'pg_subscription_rel'.
2. Change the subscription connection to point to a PostgreSQL 18 publisher.
3. Enable the subscription, which starts the sequence synchronization worker.
It logs the expected error logs:
ERROR: cannot synchronize sequences if the publisher is running a
version earlier than PostgreSQL 19
I also verified the above scenarios with PostgreSQL 19 logical
replication setup and changing the connection to PostgreSQL 18
publication
I tested both scenarios using the 'CONNECTION' and 'SERVER' variants
of 'SUBSCRIPTION', and in both cases it works as expected.
The changes look good to me.
Regards,
Vignesh