Re: Wrong table in "conflicting or redundant WHERE clauses / column lists" publicaiton error

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wrong table in "conflicting or redundant WHERE clauses / column lists" publicaiton error
Date: 2026-11-25 14:44:40
Message-ID: 3cbc55b8-11b6-4450-8f44-18bfd59ba6c9@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25/11/2026 14:01, vignesh C wrote:
> 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.

Applied, thanks!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-11-25 14:56:42 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Ayush Tiwari 2026-11-25 14:39:49 Re: pg_commit_ts pages can be written before WAL is flushed