Re: [PATCH] Support automatic sequence replication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Support automatic sequence replication
Date: 2026-02-13 11:40:23
Message-ID: CAA4eK1KVd+78zx5wweXCG-OPBZqWpri1Fyv31bC_HqwODb0J9g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 11, 2026 at 9:21 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> > Additionally, the existing ALTER SUBSCRIPTION … REFRESH SEQUENCES
> > command should be enhanced so that it can be executed on disabled
> > subscriptions and perform sequence synchronization independently,
> > without relying on the sequence sync worker. Supporting execution on a
> > disabled subscription is necessary because, if REFRESH SEQUENCES is
> > run while the subscription is enabled, the apply worker may start
> > immediately, ingest new transactions, and advance the replication
> > slot's LSN beyond the point at which sequences were last synchronized
> > again.
> >
> > Note: This approach may conservatively report that sequences need to
> > be synchronized even when no sequence values have actually changed.
> > This limitation is inherent to the design, as during an upgrade we
> > don't connect to the publisher and decode WAL between the two LSNs to
> > determine whether any sequence changes actually occurred.
> >
>
> I like the idea. In particular, I like the approach of providing a
> REFRESH SEQUENCE command to the user. Even if we don’t implement the
> check during the upgrade process, we can clearly document that users
> should verify sequence drift before upgrading. If any sequence drift
> is detected, they should run REFRESH-SEQ manually.
>

Yeah, implementing such checks are not required in upgrade but it is
better to document the use of this command in upgrade context.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-02-13 11:41:08 Re: Skipping schema changes in publication
Previous Message Daniel Gustafsson 2026-02-13 11:28:10 Re: [PATCH] PASSING clause documentation fix