| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | pgsql-docs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Improve CREATE/ALTER PUBLICATION syntax for EXCEPT |
| Date: | 2026-07-22 04:34:54 |
| Message-ID: | CAHut+PuFHHQJWAB+DsKVDFac9QEYpO4EHuUFQcK4QvvADMEPAw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs |
On Wed, Jul 22, 2026 at 1:43 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)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.
Kind Regards,
Peter Smith
Fujitsu Australia
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2026-07-22 05:36:14 | Re: Add "io worker" as backend_type to the pg_stat_activity documentation |
| Previous Message | Fujii Masao | 2026-07-22 03:43:14 | Improve CREATE/ALTER PUBLICATION syntax for EXCEPT |