pgsql: Report the correct table in publication duplicate-table errors

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Report the correct table in publication duplicate-table errors
Date: 2026-11-25 14:44:20
Message-ID: E1xWEEN-00000000H3Z-2Kjq@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Report the correct table in publication duplicate-table errors

When a table is listed explicitly and also reached through its
inheritance parent, CREATE/ALTER PUBLICATION reports "conflicting or
redundant WHERE clauses" or "conflicting or redundant column lists".

OpenTableList() reused the variable holding the explicitly named table
for each child it opened. As a result, the error could report a
different child (or the parent) instead of the table that was listed
twice. For example, with parent p and children c1 and c2, "FOR TABLE
c2, p WHERE (a > 0)" reported table "c1".

Use a separate variable for the opened child and report the
conflicting table in the error message.

Author: Vignesh C <vignesh21(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/CALDaNm3vJ8QaHYZtqk+KbRomGWPYkAzxvWzyfs_=gnSVmyvW4g@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/06cbbf874b82bae89641a943feebc1e3c2bcd645

Modified Files
--------------
src/backend/commands/publicationcmds.c | 9 +++++----
src/test/regress/expected/publication.out | 10 ++++++++++
src/test/regress/sql/publication.sql | 8 ++++++++
3 files changed, 23 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-25 16:32:36 pgsql: Clarify final phase of concurrent mode in comment
Previous Message Heikki Linnakangas 2026-11-25 14:44:19 pgsql: Report the correct table in publication duplicate-table errors