Re: Logical Replication of sequences

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, shveta malik <shveta.malik@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Chao Li <li.evan.chao@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Nisha Moond <nisha.moond412@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Euler Taveira <euler@eulerto.com>, Michael Paquier <michael@paquier.xyz>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, "Jonathan S. Katz" <jkatz@postgresql.org>
Date: 2025-10-08T10:08:18Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Doc: Add documentation for sequence synchronization.

  2. Remove unused assignment in CREATE PUBLICATION grammar.

  3. Add seq_sync_error_count to subscription statistics.

  4. Fix few issues in commit 5509055d69.

  5. Add sequence synchronization for logical replication.

  6. Add worker type argument to logical replication worker functions.

  7. Introduce "REFRESH SEQUENCES" for subscriptions.

  8. Refactor logical worker synchronization code into a separate file.

  9. Standardize use of REFRESH PUBLICATION in code and messages.

  10. Add "ALL SEQUENCES" support to publications.

  11. Expose sequence page LSN via pg_get_sequence_data.

  12. Resume conflict-relevant data retention automatically.

  13. Post-commit review fixes for 228c370868.

  14. Generate GUC tables from .dat file

On Wed, 8 Oct 2025 at 3:15 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:

> On Wed, Oct 8, 2025 at 2:41 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> >
> > On Tue, Oct 7, 2025 at 4:52 PM vignesh C <vignesh21@gmail.com> wrote:
> > >
> > > On Tue, 7 Oct 2025 at 12:09, Amit Kapila <amit.kapila16@gmail.com>
> wrote:
> > > >
> >
> > I think the patch is mostly LGTM, I have 2 suggestions, see if you
> > think this is useful.
> >
> > 1.
> > postgres[1390699]=# CREATE PUBLICATION pub FOR ALL SEQUENCES, ALL
> > TABLES WITH (publish = insert);
> > NOTICE:  55000: publication parameters are not applicable to sequence
> > synchronization and will be ignored
> > LOCATION:  CreatePublication, publicationcmds.c:905
> >
> > IMHO this notice seems confusing, from this it appears that (publish =
> > insert) is ignored completely, but actually it is is not ignored for
> > table, should we explicitely say that it will be ignored only for
> > sequences.  Something like below?
> >
> > "publication parameters are not applicable to sequence synchronization
> > so it will be used only for tables and will be ignored for sequence
> > synchronization"
> > or
> > "publication parameters are not applicable to sequence synchronization
> > so it will be ignored for the sequence synchronization"
> >
>
> How about a slightly shorter form like: 'publication parameters are
> not applicable to sequence synchronization and will be ignored for
> sequences'?



Works for me.


> 2.
> > + if (schemaidlist && (pubform->puballtables ||
> pubform->puballsequences))
> > + {
> > + if (pubform->puballtables && pubform->puballsequences)
> > + ereport(ERROR,
> > + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> > + errmsg("publication \"%s\" is defined as FOR ALL TABLES, ALL
> SEQUENCES",
> > +    NameStr(pubform->pubname)),
> > + errdetail("Schemas cannot be added to or dropped from FOR ALL
> > TABLES, ALL SEQUENCES publications."));
> > + else if (pubform->puballtables)
> > + ereport(ERROR,
> > + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> > + errmsg("publication \"%s\" is defined as FOR ALL TABLES",
> > +    NameStr(pubform->pubname)),
> > + errdetail("Schemas cannot be added to or dropped from FOR ALL TABLES
> > publications."));
> > + else
> > + ereport(ERROR,
> > + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> > + errmsg("publication \"%s\" is defined as FOR ALL SEQUENCES",
> > +    NameStr(pubform->pubname)),
> > + errdetail("Schemas cannot be added to or dropped from FOR ALL
> > SEQUENCES publications."));
> > + }
> >
> > Can't we make this a single generic error message instead of
> > duplicating for each combination?  Something like
> >
> > errmsg("publication \"%s\" is defined as FOR ALL TABLES or ALL
> SEQUENCES",
> >    NameStr(pubform->pubname)),
> > errdetail("Schemas cannot be added to or dropped from FOR ALL TABLES
> > or ALL SEQUENCES publications."));
> >
>
> Yeah,  we can do that but Note that these messages are for the
> existing publication and we are aware of its publicized contents, so
> we can give clear messages to users. Why make it ambiguous?


Hmm, yeah that makes sense.


—
Dilip