| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> |
| Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Support EXCEPT for TABLES IN SCHEMA publications |
| Date: | 2026-07-06 23:01:00 |
| Message-ID: | CAHut+PuMG0Po4HY4-b3=wa_8pJfdK-aYnSOEhSjU6xuxQ0PFbA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Nisha.
Bug: The current patch is allowing conflicting exclusion lists...
======
Background:
It's always been possible for CREATE PUBLICATION to specify the same
schema or same table multiple times.
test_pub=# CREATE SCHEMA MYSCHEMA;
CREATE SCHEMA
test_pub=# CREATE TABLE T1(A INT);
CREATE TABLE
test_pub=# CREATE TABLE MYSCHEMA.T2(A INT);
CREATE TABLE
test_pub=# CREATE TABLE MYSCHEMA.T3(A INT);
CREATE TABLE
// same table multiple times is OK
test_pub=# CREATE PUBLICATION PUB3 FOR TABLE T1,T1,T1,T1;
CREATE PUBLICATION
// same schema multiple times is OK
test_pub=# CREATE PUBLICATION PUB1 FOR TABLES IN SCHEMA MYSCHEMA,
MYSCHEMA, MYSCHEMA;
CREATE PUBLICATION
~~~
But, this behaviour is only allowed if there are no specification
conflicts. e.g. You can't have multiple tables with column lists:
test_pub=# CREATE PUBLICATION PUB4 FOR TABLE T1,T1(A),T1,T1;
ERROR: conflicting or redundant column lists for table "t1"
======
Bug:
IMO similar restrictions and a similar error message needs to happen
for clashing schema exclusions. Specifying the same schema multiple
times is fine, but it must be disallowed if there are conflicting
exclusion lists.
For example, the command below currently works, but it should not:
test_pub=# CREATE PUBLICATION PUB2 FOR TABLES IN SCHEMA MYSCHEMA
EXCEPT (TABLE T2), MYSCHEMA EXCEPT (TABLE T3), MYSCHEMA;
CREATE PUBLICATION
test_pub=# \dRp+ PUB2
Publication pub2
Owner | All tables | All sequences | Inserts | Updates | Deletes |
Truncates | Generated columns | Via root | Descri
ption
----------+------------+---------------+---------+---------+---------+-----------+-------------------+----------+-------
------
postgres | f | f | t | t | t |
t | none | f |
Tables from schemas:
"myschema"
Except tables:
"myschema.t2"
"myschema.t3"
======
Kind Regards,
Peter Smith.
Fujitsu Australia
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff Davis | 2026-07-06 23:41:34 | Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server |
| Previous Message | Tristan Partin | 2026-07-06 22:52:02 | Re: Add pg_stat_kind_info system view |