From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow table exclusions in publications via EXCEPT TABLE.
Date: Wed, 04 Mar 2026 10:33:30 +0000
Message-ID: <E1vxjXm-002KZv-2l@gemulon.postgresql.org> (raw)
Allow table exclusions in publications via EXCEPT TABLE.
Extend CREATE PUBLICATION ... FOR ALL TABLES to support the EXCEPT TABLE
syntax. This allows one or more tables to be excluded. The publisher will
not send the data of excluded tables to the subscriber.
To support this, pg_publication_rel now includes a prexcept column to flag
excluded relations. For partitioned tables, the exclusion is applied at
the root level; specifying a root table excludes all current and future
partitions in that tree.
Follow-up work will implement ALTER PUBLICATION support for managing these
exclusions.
Author: vignesh C <vignesh21@gmail.com>
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/fd366065e06ae953c4f2d973d5c5f0474f3b87b6
Modified Files
--------------
doc/src/sgml/catalogs.sgml | 10 ++
doc/src/sgml/logical-replication.sgml | 6 +-
doc/src/sgml/ref/create_publication.sgml | 57 ++++++-
doc/src/sgml/ref/psql-ref.sgml | 5 +-
src/backend/catalog/pg_publication.c | 182 +++++++++++++++-----
src/backend/commands/publicationcmds.c | 52 ++++--
src/backend/commands/tablecmds.c | 48 +++++-
src/backend/parser/gram.y | 39 ++++-
src/backend/replication/pgoutput/pgoutput.c | 43 ++++-
src/backend/utils/cache/relcache.c | 31 +++-
src/bin/pg_dump/pg_dump.c | 79 ++++++++-
src/bin/pg_dump/pg_dump.h | 1 +
src/bin/pg_dump/t/002_pg_dump.pl | 30 ++++
src/bin/psql/describe.c | 101 +++++++++--
src/bin/psql/tab-complete.in.c | 12 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_publication.h | 18 +-
src/include/catalog/pg_publication_rel.h | 1 +
src/include/nodes/parsenodes.h | 5 +-
src/test/regress/expected/publication.out | 146 ++++++++++++++--
src/test/regress/sql/publication.sql | 65 ++++++-
src/test/subscription/meson.build | 1 +
src/test/subscription/t/037_except.pl | 255 ++++++++++++++++++++++++++++
23 files changed, 1068 insertions(+), 121 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Allow table exclusions in publications via EXCEPT TABLE.
In-Reply-To: <E1vxjXm-002KZv-2l@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