| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Wrong table in "conflicting or redundant WHERE clauses / column lists" publicaiton error |
| Date: | 2026-11-25 12:01:46 |
| Message-ID: | CALDaNm3vJ8QaHYZtqk+KbRomGWPYkAzxvWzyfs_=gnSVmyvW4g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
When a table is listed explicitly and also reached through its
inheritance parent, CREATE PUBLICATION reports an error for the wrong
table. For example:
CREATE TABLE par (a int);
CREATE TABLE c1 () INHERITS (par);
CREATE TABLE c2 () INHERITS (par);
--- The table listed is c2, but the error reports c1.
CREATE PUBLICATION pub FOR TABLE c2, par WHERE (a > 0);
ERROR: conflicting or redundant WHERE clauses for table "c1"
The same problem occurs with column lists:
CREATE PUBLICATION pub FOR TABLE c2, par (a);
ERROR: conflicting or redundant column lists for table "c1"
While looping over a table's children, OpenTableList() uses rel =
table_open(childrelid, NoLock), overwriting rel, which holds the
explicitly named table. Both error messages use
RelationGetRelationName(rel), so they report the last child opened
rather than the conflicting table. In this example, c1 is not yet in
the list, so it is opened into rel. When c2 is found to be a
duplicate, rel still points to c1.
The attached patch opens each child into a separate local variable,
childrel, leaving rel unchanged. It also uses get_rel_name(childrelid)
to report the conflicting child in both error messages. The child is
already locked by find_all_inheritors(), so its name is available.
Regards,
Vignesh
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Report-the-correct-table-in-publication-duplicate.patch | application/octet-stream | 5.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-11-25 12:30:07 | Re: Add CHECK_FOR_INTERRUPTS() to XPath result serialisation |
| Previous Message | Alberto Piai | 2026-11-25 11:59:23 | Re: Allow progress tracking of sub-commands |