Re: Improve CREATE/ALTER PUBLICATION syntax for EXCEPT - Mailing list pgsql-docs

From Peter Smith
Subject Re: Improve CREATE/ALTER PUBLICATION syntax for EXCEPT
Date
Msg-id CAHut+PuFHHQJWAB+DsKVDFac9QEYpO4EHuUFQcK4QvvADMEPAw@mail.gmail.com
Whole thread
In response to Improve CREATE/ALTER PUBLICATION syntax for EXCEPT  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-docs
On Wed, Jul 22, 2026 at 1:43 PM Fujii Masao <masao.fujii@gmail.com> wrote:
>
> Hi,
>
> Attached is a small docs patch to improve the syntax and description of
> the EXCEPT clause for CREATE/ALTER PUBLICATION.
>
> The current synopsis for EXCEPT is a bit confusing because both the EXCEPT
> clause and except_table_object contain repeated lists:
>
>     ALL TABLES [ EXCEPT ( except_table_object [, ... ] ) ]
>     where except_table_object is:
>         TABLE table_object [, ... ]
>
> The patch simplifies this by describing the syntax directly:
>
>     ALL TABLES [ EXCEPT ( TABLE table_object [, [ TABLE ] table_object ] ... ) ]
>
> and removes the separate except_table_object production. I think
> this is simpler and easier to understand. Thought?
>
> The patch also updates the ALTER PUBLICATION description. The current
> wording says "adding tables/except tables/schemas", but EXCEPT entries
> are not added with ADD; they are replaced or cleared with SET ALL TABLES.
> The updated text reflects that and also notes that
> ALTER SUBSCRIPTION ... REFRESH PUBLICATION is required for such changes
> to take effect on subscribers.
>
> It also includes a few minor wording and markup fixes nearby.
>

+1 for all the description and markup changes.

But for the synopsis to change, I am not so sure...

~~~

Some might say,

ALL TABLES [ EXCEPT ( TABLE table_object [, [ TABLE ] table_object ] ... ) ]

is simpler than:

ALL TABLES [ EXCEPT ( except_table_object [, ... ] ) ]

where except_table_object is:
    TABLE table_object [, ... ]

~~~

But, soon [1] there will also be ALL SCHEMAS EXCEPT which can re-use
that same `table_object`

Is the expanded style,

ALL TABLES [ EXCEPT ( TABLE table_object [, [ TABLE ] table_object ] ... ) ]
TABLES IN SCHEMA [ EXCEPT ( TABLE table_object [, [ TABLE ]
table_object ] ... ) ]

still better than:

ALL TABLES [ EXCEPT ( except_table_object [, ... ] ) ]
TABLES IN SCHEMA [ EXCEPT ( except_table_object [, ... ] ) ]

where except_table_object is:
    TABLE table_object [, ... ]

~~~

And, consider later when entire schemas may be excluded from FOR ALL TABLES

It will be easy to write in the synopsis as:

ALL TABLES [ EXCEPT ( except_table_object | except_schema_object [, ... ] ) ]

where except_table_object is:
    TABLE table_object [, ... ]
where except_schema_object is:
    SCHEMA schema_name [, ... ]

OTOH, it would be a big mess if you tried to expand that out without
having `except_table_object` and `except_schema_object`.

~~~

So, the suggested synopsis change might seem good today, but in a
couple of years IMO we'd probably want to change it back again.

======
[1] https://www.postgresql.org/message-id/flat/CABdArM5sw4Q1ZU8HGdo4BSc1A_%2B8xtUNq17j6wcir%3DyMUy19Cg%40mail.gmail.com

Kind Regards,
Peter Smith
Fujitsu Australia



Attachment

pgsql-docs by date:

Previous
From: Fujii Masao
Date:
Subject: Improve CREATE/ALTER PUBLICATION syntax for EXCEPT
Next
From: Michael Paquier
Date:
Subject: Re: Add "io worker" as backend_type to the pg_stat_activity documentation