pgsql: Allow publishing the tables of schema.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow publishing the tables of schema.
Date: 2021-10-27 02:26:55
Message-ID: E1mfYeV-0004IP-Fq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow publishing the tables of schema.

A new option "FOR ALL TABLES IN SCHEMA" in Create/Alter Publication allows
one or more schemas to be specified, whose tables are selected by the
publisher for sending the data to the subscriber.

The new syntax allows specifying both the tables and schemas. For example:
CREATE PUBLICATION pub1 FOR TABLE t1,t2,t3, ALL TABLES IN SCHEMA s1,s2;
OR
ALTER PUBLICATION pub1 ADD TABLE t1,t2,t3, ALL TABLES IN SCHEMA s1,s2;

A new system table "pg_publication_namespace" has been added, to maintain
the schemas that the user wants to publish through the publication.
Modified the output plugin (pgoutput) to publish the changes if the
relation is part of schema publication.

Updates pg_dump to identify and dump schema publications. Updates the \d
family of commands to display schema publications and \dRp+ variant will
now display associated schemas if any.

Author: Vignesh C, Hou Zhijie, Amit Kapila
Syntax-Suggested-by: Tom Lane, Alvaro Herrera
Reviewed-by: Greg Nancarrow, Masahiko Sawada, Hou Zhijie, Amit Kapila, Haiying Tang, Ajin Cherian, Rahila Syed, Bharath Rupireddy, Mark Dilger
Tested-by: Haiying Tang
Discussion: https://www.postgresql.org/message-id/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5a2832465fd8984d089e8c44c094e6900d987fcd

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 72 +++-
doc/src/sgml/logical-replication.sgml | 14 +-
doc/src/sgml/ref/alter_publication.sgml | 77 +++-
doc/src/sgml/ref/create_publication.sgml | 76 +++-
doc/src/sgml/ref/psql-ref.sgml | 4 +-
src/backend/catalog/Makefile | 4 +-
src/backend/catalog/aclchk.c | 2 +
src/backend/catalog/dependency.c | 9 +
src/backend/catalog/objectaddress.c | 149 +++++++
src/backend/catalog/pg_publication.c | 332 +++++++++++++++-
src/backend/commands/alter.c | 1 +
src/backend/commands/event_trigger.c | 4 +
src/backend/commands/publicationcmds.c | 490 +++++++++++++++++++++--
src/backend/commands/seclabel.c | 1 +
src/backend/commands/tablecmds.c | 28 ++
src/backend/nodes/copyfuncs.c | 22 +-
src/backend/nodes/equalfuncs.c | 21 +-
src/backend/parser/gram.y | 307 +++++++++++----
src/backend/replication/pgoutput/pgoutput.c | 19 +-
src/backend/utils/cache/relcache.c | 7 +
src/backend/utils/cache/syscache.c | 23 ++
src/bin/pg_dump/common.c | 5 +-
src/bin/pg_dump/pg_backup_archiver.c | 3 +-
src/bin/pg_dump/pg_dump.c | 143 ++++++-
src/bin/pg_dump/pg_dump.h | 13 +
src/bin/pg_dump/pg_dump_sort.c | 7 +
src/bin/pg_dump/t/002_pg_dump.pl | 30 ++
src/bin/psql/describe.c | 198 ++++++++--
src/bin/psql/tab-complete.c | 40 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/dependency.h | 1 +
src/include/catalog/pg_publication.h | 8 +
src/include/catalog/pg_publication_namespace.h | 47 +++
src/include/commands/publicationcmds.h | 1 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/parsenodes.h | 33 +-
src/include/utils/syscache.h | 2 +
src/test/regress/expected/alter_table.out | 14 +
src/test/regress/expected/object_address.out | 6 +-
src/test/regress/expected/oidjoins.out | 2 +
src/test/regress/expected/publication.out | 522 ++++++++++++++++++++++++-
src/test/regress/expected/sanity_check.out | 1 +
src/test/regress/sql/alter_table.sql | 12 +
src/test/regress/sql/object_address.sql | 3 +
src/test/regress/sql/publication.sql | 281 ++++++++++++-
src/tools/pgindent/typedefs.list | 5 +
46 files changed, 2830 insertions(+), 212 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-10-27 04:15:46 Re: pgsql: Allow GRANT on pg_log_backend_memory_contexts().
Previous Message Amit Kapila 2021-10-27 02:00:20 Re: pgsql: Remove unused wait events.