pgsql: Add support for EXCEPT TABLE in ALTER PUBLICATION.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add support for EXCEPT TABLE in ALTER PUBLICATION.
Date: 2026-03-20 06:12:17
Message-ID: E1w3T5k-000bI4-0j@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add support for EXCEPT TABLE in ALTER PUBLICATION.

Following commit fd366065e0, which added EXCEPT TABLE support to
CREATE PUBLICATION, this commit extends ALTER PUBLICATION to allow
modifying the exclusion list.

New Syntax:
ALTER PUBLICATION name SET publication_all_object [, ... ]

where publication_all_object is one of:
ALL TABLES [ EXCEPT TABLE ( except_table_object [, ... ] ) ]
ALL SEQUENCES

If the EXCEPT clause is provided, the existing exclusion list in
pg_publication_rel is replaced with the specified relations. If the
EXCEPT clause is omitted, any existing exclusions for the publication
are cleared. Similarly, SET ALL SEQUENCES updates

Note that because this is a SET command, specifying only one object
type (e.g., SET ALL SEQUENCES) will reset the other unspecified flags
(e.g., setting puballtables to false).

Consistent with CREATE PUBLICATION, only root partitioned tables or
standard tables can be specified in the EXCEPT list. Specifying a
partition child will result in an error.

Author: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Peter Smith <smithpb2250(at)gmail(dot)com>
Reviewed-by: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/493f8c6439cf64d75883c650b5dd573d8fe0664b

Modified Files
--------------
doc/src/sgml/ref/alter_publication.sgml | 79 ++++++++++++++++----
src/backend/catalog/pg_publication.c | 66 +++++++++++++++--
src/backend/commands/publicationcmds.c | 116 +++++++++++++++++++++++++++---
src/backend/commands/tablecmds.c | 3 +-
src/backend/parser/gram.y | 23 ++++++
src/bin/psql/tab-complete.in.c | 13 +++-
src/include/catalog/pg_publication.h | 4 +-
src/include/nodes/parsenodes.h | 2 +
src/test/regress/expected/publication.out | 93 +++++++++++++++++++++++-
src/test/regress/sql/publication.sql | 55 +++++++++++++-
src/test/subscription/t/037_except.pl | 36 +++++++++-
11 files changed, 453 insertions(+), 37 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-03-20 07:48:58 pgsql: Update Unicode data to Unicode 17.0.0
Previous Message David Rowley 2026-03-20 01:16:26 pgsql: Fix new tuple deforming code so it can support cstrings again