public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Smith <[email protected]>
To: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Include sequences in publications created by pg_createsubscriber
Date: Tue, 23 Jun 2026 13:03:23 +1200
Message-ID: <CAHut+PtGOeXr69qQRgq_DW=BEEix_6bDsgmR8Vk4_qbNy5BvAA@mail.gmail.com> (raw)
In-Reply-To: <CALDaNm2RYQRLjexRJOpiZOFkspp8PRgoh6S7d2y003TJ_TSSZA@mail.gmail.com>
References: <CALDaNm2RYQRLjexRJOpiZOFkspp8PRgoh6S7d2y003TJ_TSSZA@mail.gmail.com>

On Sat, Jun 20, 2026 at 1:59 AM vignesh C <[email protected]> wrote:
...
> The attached patch modifies pg_createsubscriber to include sequences
> in the publication it creates, enabling this workflow.
> Thoughts?
>

Hi Vignesh,

+1 to make this change.

Some review comments for patch 0001.

======
Commit Message

1.
This change modifies pg_createsubscriber to include all sequences in the
publication it creates. Administrators can then run ALTER SUBSCRIPTION
... REFRESH SEQUENCES after the upgrade to synchronize sequence state,
ensuring a more complete and reliable upgrade workflow.

~

/include all sequences/include ALL SEQUENCES/

======
doc/src/sgml/ref/pg_createsubscriber.sgml

2.
-   does not copy the initial table data. It does only the
synchronization phase,
-   which ensures each table is brought up to a synchronized state.
+   does not copy the initial table or sequence data. It does only the
+   synchronization phase, which ensures each table and sequence is brought up
+   to a synchronized state.
   </para>

I felt "does not copy the initial [...] sequence data" should not be
said for sequences. AFAIK each sequence has only 1 value anyway, so
bringing it "to a synchronized state" is effectively the same thing as
copying the initial data for sequences, so saying in the first
sentence that copy does not happen seems a contradiction.

IIUC what above means is really just the same as chapter 29.7, which
says "use CREATE SUBSCRIPTION to initially synchronize the published
sequences.".

~~~

3.
       linkend="sql-createpublication-params-for-all-tables"><literal>FOR ALL
-      TABLES</literal></link>.  If the <option>--publication</option> option
+      TABLES</literal></link> and <link
+      linkend="sql-createpublication-params-for-all-sequences"><literal>FOR ALL
+      SEQUENCES</literal></link>.  If the <option>--publication</option> option
       is not specified, the publication has the following name pattern:

Maybe just say "ALL SEQUENCES" here instead of "FOR ALL SEQUENCES"?

~~~

4.
      <para>
       Enable the subscription for each specified database on the target server.
       The subscription starts applying transactions from the replication start
-      point.
+      point. The subscription is configured to include sequences. Sequence
+      values can be synchronized at any time by running
+      <link linkend="sql-altersubscription-params-refresh-sequences">
+      <command>ALTER SUBSCRIPTION ... REFRESH SEQUENCES</command></link>, which
+      fetches the current sequence state from the publisher and advances the
+      corresponding subscriber sequences.
      </para>

IIUC, all this "How it works" section is describing the internal logic
of what pg_subscriber is internally. OTOH, this "REFRESH SEQUENCES" is
just a note about what the Administrator can do manually later...

So, maybe you can still write this note somewhere, but just don't
include it buried in the internal "How it works" steps.

======
src/bin/pg_basebackup/pg_createsubscriber.c

5.
Patch needs also to update the function comment for
create_publication() because currently it still says "includes all
tables".

======
Kind Regards,
Peter Smith.
Fujitsu Australia






view thread (23+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Include sequences in publications created by pg_createsubscriber
  In-Reply-To: <CAHut+PtGOeXr69qQRgq_DW=BEEix_6bDsgmR8Vk4_qbNy5BvAA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox