All,

Currently, the syntax we plan to support in patch001 is:

CREATE PUBLICATION pub for ALL TABLES EXCEPT TABLE (tab1, tab2, ...)

That is:

a) The TABLE keyword is mandatory after EXCEPT.
b) Parentheses around the table list are mandatory.

There has been some confusion regarding the EXCEPT syntax. Below are
the points that help justify the above syntax.

1) TABLE keyword:

Consider the command:
CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT (tab1, tab2);

At first glance, this appears acceptable even without the TABLE
keyword after EXCEPT. However, in the future, if we support excluding
a particular schema, for example:

CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT SCHEMA s1, s2;

then it becomes necessary to explicitly specify whether we are
excluding a TABLE, SCHEMA, or SEQUENCE after EXCEPT.

Similarly, if we extend CREATE PUBLICATION to support something like:
CREATE PUBLICATION pub
FOR TABLES, SEQUENCES IN SCHEMA sch1
EXCEPT TABLE (t1), EXCEPT SEQUENCE (s1);

then also, the TABLE or SEQUENCE keyword after EXCEPT becomes
mandatory for clarity.

2) Parentheses:

Currently, we do not use parentheses around table names in commands such as:
CREATE PUBLICATION pub1 FOR TABLE tab1, tab2;

So it may seem acceptable to allow:
CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT tab1, tab2;

However, if we later support syntax like:

CREATE PUBLICATION pub FOR TABLES IN SCHEMA s1 EXCEPT TABLE t;

the future syntax for pub with tables-in-schema with EXCEPT and a
regular table-inclusion might look like:

CREATE PUBLICATION pub FOR TABLES IN SCHEMA s1 EXCEPT TABLE (t1, t2), TABLE t3;

This is much clearer than a version without parentheses:

CREATE PUBLICATION pub FOR TABLES IN SCHEMA s1 EXCEPT TABLE t1, t2, TABLE t3;

In the first version, it is clearly understood that t1 and t2 are
excluded, while t3 is included. Without parentheses, the intent
becomes ambiguous.

Therefore, making both the TABLE keyword and parentheses mandatory
after EXCEPT ensures clarity and extensibility for future
enhancements.

~~

So we will proceed with this syntax unless there are any objections.

thanks
Shveta


Reply via email to