Re: Include sequences in publications created by pg_createsubscriber

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-29T08:49:06Z
Lists: pgsql-hackers

Attachments

On Fri, 26 Jun 2026 at 03:50, Peter Smith <smithpb2250@gmail.com> wrote:
>
> Some review comments for v3.
>
> ======
> doc/src/sgml/ref/pg_createsubscriber.sgml
>
> 1.
>    <para>
>     <application>pg_createsubscriber</application> creates a new logical
>     replica from a physical standby server.  All tables in the specified
> -   database are included in the <link linkend="logical-replication">logical
> -   replication</link> setup.  A pair of
> -   publication and subscription objects are created for each database.  It
> -   must be run at the target server.
> +   database are included in the
> +   <link linkend="logical-replication">logical replication</link> setup. The
> +   publications created by <application>pg_createsubscriber</application> also
> +   include all sequences, allowing their state to be synchronized after the
> +   upgrade. A pair of publication and subscription objects are created for each
> +   database. It must be run at the target server.
>    </para>
>
> This is not properly distinguishing between the internal publications
> versus user-nominated publications. I think it needs to clarify
> up-front that all of this "Description" part is really only talking
> about the (default) behaviour of using the *internally* generated FOR
> ALL TABLES, ALL SEQUENCE publications.
>
> e.g. "All tables in the specified database are included" ... that
> might not be true for user pubs.
> e.g. "A pair of publication and subscription objects are created" ...
> not for user pubs; they already exist.
>
> ~~~
>
> 2.
>     replication setup and <application>pg_createsubscriber</application> is how
>     the data synchronization is done.
> <application>pg_createsubscriber</application>
>     does not copy the initial table data. It does only the
> synchronization phase,
> -   which ensures each table is brought up to a synchronized state.
> +   which ensures each table is brought up to a synchronized state. The
> +   subscriptions are configured to include sequences, but sequence values are
> +   not synchronized automatically.
>
> Similar here.
>
> "The subscriptions are configured to include sequences" may not be
> true for the case of user-specified pubs. Also, (from my previous
> review), subscriptions are not really "configured" to include
> sequences -- if they subscribe to sequences, that is only because
> their associated publication is publishing sequences.
>

Thanks for the comments, here is an updated version with the fixes for the same.

Regards,
Vignesh

Commits

  1. Add sequence synchronization for logical replication.

  2. Add "ALL SEQUENCES" support to publications.