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

From Amit Kapila
Subject Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.
Date
Msg-id CAA4eK1LxHF0nPQ_KPHN+x5JqSL-Z7dRxAGei7X=Mqya8A9TOGg@mail.gmail.com
Whole thread
In response to Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.
List pgsql-committers
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

--
With Regards,
Amit Kapila

pgsql-committers by date:

Previous
From: shveta malik
Date:
Subject: Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.
Next
From: Pavel Stehule
Date:
Subject: Re: pgsql: Change syntax of EXCEPT TABLE clause in publication commands.