From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add decoding of sequences to built-in replication
Date: Thu, 24 Mar 2022 17:49:45 +0000
Message-ID: <E1nXRai-001CRk-Cw@gemulon.postgresql.org> (raw)
Add decoding of sequences to built-in replication
This commit adds support for decoding of sequences to the built-in
replication (the infrastructure was added by commit 0da92dc530).
The syntax and behavior mostly mimics handling of tables, i.e. a
publication may be defined as FOR ALL SEQUENCES (replicating all
sequences in a database), FOR ALL SEQUENCES IN SCHEMA (replicating
all sequences in a particular schema) or individual sequences.
To publish sequence modifications, the publication has to include
'sequence' action. The protocol is extended with a new message,
describing sequence increments.
A new system view pg_publication_sequences lists all the sequences
added to a publication, both directly and indirectly. Various psql
commands (\d and \dRp) are improved to also display publications
including a given sequence, or sequences included in a publication.
Author: Tomas Vondra, Cary Huang
Reviewed-by: Peter Eisentraut, Amit Kapila, Hannu Krosing, Andres
Freund, Petr Jelinek
Discussion: https://postgr.es/m/d045f3c2-6cfb-06d3-5540-e63c320df8bc@enterprisedb.com
Discussion: https://postgr.es/m/1710ed7e13b.cd7177461430746.3372264562543607781@highgo.ca
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/75b1521dae1ff1fde17fda2e30e591f2e5d64b6a
Modified Files
--------------
doc/src/sgml/catalogs.sgml | 81 ++
doc/src/sgml/protocol.sgml | 119 +++
doc/src/sgml/ref/alter_publication.sgml | 25 +-
doc/src/sgml/ref/alter_subscription.sgml | 8 +-
doc/src/sgml/ref/create_publication.sgml | 51 +-
src/backend/catalog/objectaddress.c | 44 +-
src/backend/catalog/pg_publication.c | 328 +++++++-
src/backend/catalog/system_views.sql | 10 +
src/backend/commands/publicationcmds.c | 424 ++++++++--
src/backend/commands/sequence.c | 154 ++++
src/backend/commands/subscriptioncmds.c | 101 ++-
src/backend/commands/tablecmds.c | 27 +-
src/backend/executor/execReplication.c | 4 +-
src/backend/nodes/copyfuncs.c | 4 +-
src/backend/nodes/equalfuncs.c | 4 +-
src/backend/parser/gram.y | 52 +-
src/backend/replication/logical/proto.c | 52 ++
src/backend/replication/logical/tablesync.c | 109 ++-
src/backend/replication/logical/worker.c | 56 ++
src/backend/replication/pgoutput/pgoutput.c | 79 +-
src/backend/utils/cache/relcache.c | 28 +-
src/backend/utils/cache/syscache.c | 6 +-
src/bin/pg_dump/pg_dump.c | 65 +-
src/bin/pg_dump/pg_dump.h | 3 +
src/bin/pg_dump/t/002_pg_dump.pl | 40 +-
src/bin/psql/describe.c | 287 +++++--
src/bin/psql/tab-complete.c | 12 +-
src/include/catalog/pg_proc.dat | 5 +
src/include/catalog/pg_publication.h | 26 +-
src/include/catalog/pg_publication_namespace.h | 10 +-
src/include/commands/sequence.h | 1 +
src/include/nodes/parsenodes.h | 8 +-
src/include/replication/logicalproto.h | 19 +
src/include/replication/pgoutput.h | 1 +
src/test/regress/expected/object_address.out | 10 +-
src/test/regress/expected/publication.out | 1009 +++++++++++++++++++-----
src/test/regress/expected/rules.out | 8 +
src/test/regress/sql/object_address.sql | 5 +-
src/test/regress/sql/publication.sql | 226 +++++-
src/test/subscription/t/030_sequences.pl | 202 +++++
40 files changed, 3235 insertions(+), 468 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tomas.vondra@postgresql.org
Subject: Re: pgsql: Add decoding of sequences to built-in replication
In-Reply-To: <E1nXRai-001CRk-Cw@gemulon.postgresql.org>
References: <E1nXRai-001CRk-Cw@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox