Re: Logical Replication of sequences

shveta malik <shveta.malik@gmail.com>

From: shveta malik <shveta.malik@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@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>, Dilip Kumar <dilipbalaut@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>, shveta malik <shveta.malik@gmail.com>
Date: 2025-10-07T05:23:14Z
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 Mon, Oct 6, 2025 at 4:33 PM vignesh C <vignesh21@gmail.com> wrote:
>
>
> Here is the rebased remaining patches.
>

Thank You for the patches, please find a few comment on 001:

1)
Shall we have 'pg_publication_sequences' created in the first patch
itself to help verify which all sequences are added to ALL SEQ
publications? Currently it is in 4th patch.

2)
postgres=# create publication pub1 for all sequences WITH(publish='insert');
ERROR:  publication parameters are not supported for publications
defined as FOR ALL SEQUENCES

postgres=# alter publication pub1 add table tab1;
ERROR:  Tables or sequences cannot be added to or dropped from
publication defined FOR ALL TABLES, ALL SEQUENCES, or both

a) First msg has 'as', while second does not. Shall we make both the
same? I think we can get rid of 'as'.
b) Shouldn't the error msg start with lower case (second one)?


3)
+ * Process all_objects_list to set all_tables/all_sequences.

can we please replace 'all_tables/all_sequences' with 'all_tables
and/or all_sequences'

4)
+/*
+ * Publication types supported by FOR ALL ...
+ */
+typedef enum PublicationAllObjType

Should it be:
'Types of objects supported by FOR ALL publications'

5)
+-- Specifying both ALL TABLES and ALL SEQUENCES along with WITH
clause should throw a warning
+SET client_min_messages = 'NOTICE';
+CREATE PUBLICATION regress_pub_for_allsequences_alltables_withcaluse
FOR ALL SEQUENCES, ALL TABLES WITH (publish = 'insert');
+NOTICE:  publication parameters are not applicable to sequence
synchronization and will be ignored

Comment can be changed to say it will emit/raise a NOTICE (instead of warning).

6)
commit msg:
--
Note: This patch currently supports only the "ALL SEQUENCES" clause.
Handling of clauses such as "FOR SEQUENCE" and "FOR SEQUENCES IN SCHEMA"
will be addressed in a subsequent patch.
--

This seems misleading, as we are not planning the "FOR SEQUENCE" in
the current set of patches, maybe we can rephrase it a bit.

thanks
Shveta