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 <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/CALDaNm3vJ8QaHYZtqk+KbRomGWPYkAzxvWzyfs_=gnsvmyv...@mail.gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/048c8725bf9aaa4ce14727509f22c7eda68269da

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(-)

Reply via email to