Re: Support EXCEPT for TABLES IN SCHEMA publications

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(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-07-01 10:12:38
Message-ID: CABdArM4nVk-umQ_VXoGCrb7gQ_VcM5gHFcDOOa9EQbiUC-0EsA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

During tests, I found one behavior that needs discussion:

Consider a partition hierarchy where the root table is in schema s2, a
child partition is in schema s1, and the publication includes both
schemas but excludes only the root table.
Test case:
-- Root of the partition tree lives in s2
CREATE TABLE s2.parent (id int) PARTITION BY LIST (id);

-- Child partition lives in s1
CREATE TABLE s1.part PARTITION OF s2.parent FOR VALUES IN (1, 2, 3);

-- Publication covers BOTH schemas, but EXCEPTs only s2.parent
CREATE PUBLICATION p FOR TABLES IN SCHEMA s1, TABLES IN SCHEMA s2
EXCEPT (TABLE s2.parent);

Currently, if the root is excluded, all child partitions are also
excluded, meaning s1.part is not published. However, s1 never excluded
'part' explicitly, so the behavior may not be intuitive.

We need to decide whether child partitions should always remain
excluded when the root is excluded (regardless of schema), or whether
schema membership should still allow publication.

I've added an XXX comment in pg_publication.c to track this until we
conclude on the expected behavior. Suggestions are welcome.

--
Thanks,
Nisha

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-07-01 10:16:43 Re: Support EXCEPT for TABLES IN SCHEMA publications
Previous Message Nisha Moond 2026-07-01 10:07:01 Re: Support EXCEPT for TABLES IN SCHEMA publications