| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Cc: | Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(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-14 14:15:46 |
| Message-ID: | CALDaNm0802S=557rKtYcV+oEbXFw23n=XtPHMCbKGSgOgOgk2A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 12 Aug 2026 at 11:42, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> I thought some more. Please find my analysis and opinion on all
> related scenarios:
>
> Metadata:
> schema s1: parent
> schema s2: parition/child of parent.
>
> Scenarios:
> a) s1.s1.parent is a partitioned table, and its partitions live in
> another schema. Or
> b) s1.parent is a parent table, and its descendants/inherited tables
> live in another schema.
>
> ~~
>
> Now consider the exclusion cases:
>
> Case 1: No contradiction in EXCEPT
> -----------------------------------------
> CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA s1 EXCEPT (TABLE s1.parent*);
>
> My opinion:
> In both cases a) and b), s1.parent will be included in the
> publication. Its partitions or descendants, however, will not be
> included because they belong to another schema (s2), which is not
> included in the publication. Thus, they are effectively excluded due
> to the absence of a schema inclusion rule, rather than by the EXCEPT
> clause.
>
>
> Case 2: Indirect contradiction in EXCEPT
> --------------------------------------------------------
> CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA s1 EXCEPT (TABLE
> s1.parent*), TABLES IN SCHEMA s2;
>
> The above command creates an indirect logical contradiction. The
> child/partition is explicitly brought into the publication pool
> through the schema inclusion rule (TABLES IN SCHEMA s2), while at the
> same time being excluded by the recursive EXCEPT (TABLE s1.parent*)
> clause of another schema. I believe this should result in the same
> error that we have already concluded and implemented in the following
> case:
Thanks for the feedback. I have made the changes to handle inheritance
tables. I will address the partition table case in a follow-up patch.
The attached v27 patch has the changes for the same.
Regards,
Vignesh
| Attachment | Content-Type | Size |
|---|---|---|
| v27-0001-Support-EXCEPT-clause-for-schema-level-publicati.patch | application/octet-stream | 106.6 KB |
| v27-0003-Add-EXCEPT-support-to-ALTER-PUBLICATION-SET-TABL.patch | application/octet-stream | 42.3 KB |
| v27-0004-Documentation-Patch.patch | application/octet-stream | 11.4 KB |
| v27-0002-Add-EXCEPT-support-to-ALTER-PUBLICATION-ADD-TABL.patch | application/octet-stream | 30.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-08-14 14:16:09 | Re: Add a pg_wal_preallocate() SQL function to eagerly create future WAL segments |
| Previous Message | Matthias van de Meent | 2026-08-14 14:08:24 | Thread-safe stringToNode() / pg_strtok() |