Re: Support EXCEPT for TABLES IN SCHEMA publications

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications
Date: 2026-08-19 10:17:35
Message-ID: CALDaNm307nX58RSmhDr2u-aFUZ_hf+FdcdT5Jikt6F7VZQDoJA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 18 Aug 2026 at 13:34, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Vignesh/Nisha,
>
> IMO, it feels like these patches are doing too much work trying to
> protect the user from themselves, and it is even making some
> combinations difficult to specify.
>
> Also, there is a lot of logic and many lines of code now just for
> checking publication command "inconsistencies".

I still feel we should throw the error at CREATE PUBLICATION itself.
That would make the conflict clear to the user and allow them to
modify the publication accordingly. Otherwise, in a conflicting case
like the following, it may be unclear whether the table will actually
be published:
CREATE TABLE s1.parent (a int);
CREATE TABLE s2.child (b int) INHERITS (s1.parent);
CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA s1 EXCEPT (TABLE s1.parent), s2;

Here, it may not be obvious whether s2.child will be published because
schema s2 is included, or whether it will be skipped because its
parent s1.parent is specified in the EXCEPT clause.

I have tried to simplify the patch. The new version now only has two
changes to detect the new conflicts:
a) GetExceptCrossSchemaDescendants - Collects descendants of the
EXCEPT entries that reside outside the schema of the corresponding
TABLES IN SCHEMA clause.
b) Add few additional checks to the existing
CheckExceptConflicts(renamed from CheckExceptNotInTableList)
Checks whether any of these cross-schema descendants are also being
published, either explicitly or through another TABLES IN SCHEMA
clause, and throws an error if they are.

Please have a look and let me know whether the v29 version is simpler.

Regards,
Vignesh

Attachment Content-Type Size
v29-0001-Support-EXCEPT-clause-for-schema-level-publicati.patch application/octet-stream 107.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-08-19 10:31:28 aio: Don't silently drop wait_event_info
Previous Message Jelte Fennema-Nio 2026-08-19 10:10:47 Re: Python/pytest test framework take two