Re: Include schema-qualified names in publication error messages.

Peter Smith <smithpb2250@gmail.com>

From: Peter Smith <smithpb2250@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Euler Taveira <euler@eulerto.com>, "shveta.malik@gmail.com" <shveta.malik@gmail.com>, vignesh C <vignesh21@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, shveta malik <shvetamalik@gmail.com>
Date: 2026-05-11T07:47:59Z
Lists: pgsql-hackers
I was looking at the code that got pushed [1] for this thread, and I
think there is some quirky quote behaviour:

* The code ends up calling 'quote_qualified_identifier'. That function
does "quoting each component if necessary" (the function name is a
hint!).

* Meanwhile, the error message where the result is substituted already
has hardwired quotes:
errormsg = gettext_noop("cannot specify relation \"%s\" in the
publication EXCEPT clause");

So, nested quoting might occur in the error message.

e.g.
------
test_pub=# CREATE UNLOGGED TABLE "my table"(c int);
CREATE TABLE
test_pub=# CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT (TABLE "my table");
ERROR:  cannot specify relation "public."my table"" in the publication
EXCEPT clause
DETAIL:  This operation is not supported for unlogged tables.
------

Is that quote nesting OK?

I didn't see this behaviour discussed or tested anywhere, so I cannot
tell whether this was considered already or not.

======
[1] https://github.com/postgres/postgres/commit/a49b9cfd72d89a8fd68c90e84c38aa7e2ada756b

Kind Regards,
Peter Smith.
Fujitsu Australia