Re: CREATE/ALTER PUBLICATION improvements for syntax synopsis

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>, Peter Smith <smithpb2250@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-14T08:01:55Z
Lists: pgsql-hackers

> On Nov 14, 2025, at 15:47, Fujii Masao <masao.fujii@gmail.com> wrote:
> 
> On Fri, Nov 14, 2025 at 10:23 AM Peter Smith <smithpb2250@gmail.com> wrote:
>> 
>> A rebase was needed. Here is patch v3.
> 
> Thanks for the patch! LGTM.
> 
> For example, in the CREATE PUBLICATION synopsis, the part that can be
> repeated is "[ ONLY ] table_name ... [ WHERE ( expression ) ]" not just
> the WHERE clause, so using curly brackets around that seems correct.
> 

I disagree. {…} means “choose exactly one of the following alternatives”, but not for grouping for repetition.

For example:

```
GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | MAINTAIN }
[, ...] | ALL [ PRIVILEGES ] }
ON { [ TABLE ] table_name [, ...]
| ALL TABLES IN SCHEMA schema_name [, ...] }
TO role_specification [, ...] [ WITH GRANT OPTION ]
[ GRANTED BY role_specification ]
```

The two levels of {} are all for alternatives.

So, I think the correct way is like:

```
TABLE table_spec [, TABLE table_spec … ]
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







Commits

  1. doc: Fix misleading synopsis for CREATE/ALTER PUBLICATION.