| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Introduce "REFRESH SEQUENCES" for subscriptions. |
| Date: | 2025-10-23 08:43:54 |
| Message-ID: | E1vBqvK-0035q5-2d@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Introduce "REFRESH SEQUENCES" for subscriptions.
This patch adds support for a new SQL command:
ALTER SUBSCRIPTION ... REFRESH SEQUENCES
This command updates the sequence entries present in the
pg_subscription_rel catalog table with the INIT state to trigger
resynchronization.
In addition to the new command, the following subscription commands have
been enhanced to automatically refresh sequence mappings:
ALTER SUBSCRIPTION ... REFRESH PUBLICATION
ALTER SUBSCRIPTION ... ADD PUBLICATION
ALTER SUBSCRIPTION ... DROP PUBLICATION
ALTER SUBSCRIPTION ... SET PUBLICATION
These commands will perform the following actions:
Add newly published sequences that are not yet part of the subscription.
Remove sequences that are no longer included in the publication.
This ensures that sequence replication remains aligned with the current
state of the publication on the publisher side.
Note that the actual synchronization of sequence data/values will be
handled in a subsequent patch that introduces a dedicated sequence sync
worker.
Author: Vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Reviewed-by: Peter Smith <smithpb2250(at)gmail(dot)com>
Reviewed-by: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Reviewed-by: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Hou Zhijie <houzj(dot)fnst(at)fujitsu(dot)com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f0b3573c3aac6c0ea4cbc278f98178516579d370
Modified Files
--------------
doc/src/sgml/catalogs.sgml | 29 +-
doc/src/sgml/ref/alter_subscription.sgml | 42 ++-
src/backend/catalog/pg_subscription.c | 53 ++-
src/backend/commands/subscriptioncmds.c | 480 ++++++++++++++++++++++------
src/backend/executor/execReplication.c | 28 +-
src/backend/parser/gram.y | 9 +
src/backend/replication/logical/proto.c | 3 +
src/backend/replication/logical/relation.c | 12 +
src/backend/replication/logical/syncutils.c | 5 +-
src/backend/replication/logical/tablesync.c | 2 +-
src/backend/replication/logical/worker.c | 2 +
src/backend/replication/pgoutput/pgoutput.c | 6 +-
src/bin/psql/tab-complete.in.c | 10 +-
src/include/catalog/pg_subscription_rel.h | 3 +-
src/include/executor/executor.h | 4 +-
src/include/nodes/parsenodes.h | 1 +
src/test/subscription/meson.build | 1 +
src/test/subscription/t/036_sequences.pl | 55 ++++
src/tools/pgindent/typedefs.list | 1 +
19 files changed, 607 insertions(+), 139 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2025-10-23 12:21:22 | Re: pgsql: Use CompactAttribute more often, when possible |
| Previous Message | Michael Paquier | 2025-10-23 07:00:15 | pgsql: pg_rewind: Extend code detecting relation files to work with WAL |