On Fri, Mar 13, 2026 at 2:51 AM Amit Kapila <[email protected]> wrote:
>
> On Fri, Mar 13, 2026 at 8:55 AM Peter Smith <[email protected]> wrote:
> >
> > Hou-San (off-list) gave an interesting example of how it might look
> > when the example is combined with the hypothetical future ability to
> > exclude all schema tables from a "FOR ALL TABLES"
> > CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, t2, TABLES IN
> > SCHEMA s1);
> >
>
> So, if we follow this, in future, the syntax would look like:
> Create publication pub1 FOR ALL TABLES EXCEPT (TABLE t1, t2, TABLES IN
> SCHEMA s1, s2), ALL SEQUENCES EXCEPT (SEQUENCE s1);
>
> I think if we use the above syntax then one can also argue that why
> not use FOR ALL (TABLES, SEQUENCES) instead of ALL TABLES, ALL
> SEQUENCES.

The same is true for the syntaxes of TABLE(t1, t2) and SCHEMA(s1, s2),
no? If we allow grouping the tables and the schemas by TABLE and
SCHEMA keywords respectively in exclusion lists, one could argue why
we don't allow it for the inclusion list.

>
> Instead the current command would like:
> Create publication pub1 FOR ALL TABLES EXCEPT TABLE (t1, t2), EXCEPT
> TABLES IN SCHEMA (s1, s2), ALL SEQUENCES EXCEPT SEQUENCE (seq1, seq2);
>
> Though it is slightly lengthy it makes the syntax local such that the
> meaning of a clause is determined by what is inside it, not by
> something that appears ten words later.

While it helps the syntax locality, I'm concerned that it could make
the context of the EXCEPT clause ambiguous. For example, IIUC the
above syntax rule would allow us to write:

CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT TABLES IN SCHEMA (s1),
EXCEPT TABLE (t1);

Regarding the second EXCEPT clause, while one might think it excludes
t1 from ALL TABLES, one might think it excludes t1 from the first
EXCLUDE clause (i.e., the publication actually includes t1 in the
publication).

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com


Reply via email to