Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands. - Mailing list pgsql-committers

From Pavel Stehule
Subject Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.
Date
Msg-id CAFj8pRCB5Hpzq-6O8mznA_pJrejoaUhExbSAg9Xd_88rAn+8BA@mail.gmail.com
Whole thread
In response to Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-committers
Hi

út 31. 3. 2026 v 7:01 odesílatel Amit Kapila <amit.kapila16@gmail.com> napsal:
On Tue, Mar 31, 2026 at 10:17 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
> út 31. 3. 2026 v 6:18 odesílatel Amit Kapila <akapila@postgresql.org> napsal:
>>
>> Change syntax of EXCEPT TABLE clause in publication commands.
>>
>> Adjust the syntax of the EXCEPT clause in CREATE/ALTER PUBLICATION
>> added in commits fd366065e0 and 493f8c6439 to move the TABLE keyword
>> inside the relation list.
>>
>> Old syntax:
>> CREATE PUBLICATION ... FOR ALL TABLES EXCEPT TABLE (t1, ...);
>> ALTER PUBLICATION  ... SET ALL TABLES EXCEPT TABLE (t1, ...);
>>
>> New syntax:
>> CREATE PUBLICATION ... FOR ALL TABLES EXCEPT (TABLE t1, ...);
>> ALTER PUBLICATION  ... SET ALL TABLES EXCEPT (TABLE t1, ...);
>>
>> This is to ensure that inclusion and exclusion list can be specified in
>> a same way. Previously, the exclusion table list can be specified as
>> TABLE (t1, t2, t3) and inclusion list can be specified as TABLE t1, t2,
>> t3, or TABLE t1, TABLE t2, TABLE t3.
>>
>> This change is purely syntactic and does not alter behavior.
>
>
> I am late, I am sorry. I don't think the new syntax is intuitive.
>
> Why is the keyword TABLE necessary there?
>

We discussed this during the development. See email[1].

>
> Cannot be just:
>
> CREATE PUBLICATION ... FOR ALL TABLES EXCEPT (t1, ...);
>

Consider cases where we need to exclude all tables in schema. So we can have something like: CREATE PUBLICATION ... FOR ALL TABLES EXCEPT (SCHEMA t1, ...);. We need a way to distinguish whether the exclusion object is a schema or table similar to what is present inclusion list like  CREATE PUBLICATION ... FOR TABLE t1, TABLES IN SCHEMA s1;

[1]: https://www.postgresql.org/message-id/CAJpy0uB%3DJxTYXOB7VmrhVLR%2B1PG0%3DTtHuGekaqibOPpo2UBLiQ%40mail.gmail.com

make sense

Thank you for info

Regards

Pavel 

--
With Regards,
Amit Kapila

pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Disable some C++ warnings in MSVC