pgsql: Report the correct table in publication duplicate-table errors
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@gmail.com>
Discussion: /messages/by-id/CALDaNm3vJ8QaHYZtqk+KbRomGWPYkAzxvWzyfs_=gnSVmyvW4g@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/f574b2eb84cb09474e350f8f24149b062062c364
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(-)