On Mon, 11 May 2026 at 13:18, Peter Smith <[email protected]> wrote:
>
> 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 think this is acceptable, since we already emit similar quoting in
other error messages involving schema qualified identifiers.
For example:
CREATE MATERIALIZED VIEW  "my matv1" as select sum(c1) from t1;

REFRESH MATERIALIZED VIEW concurrently "my matv1";
produces:
ERROR:  cannot refresh materialized view "public."my matv1"" concurrently
HINT:  Create a unique index with no WHERE clause on one or more
columns of the materialized view.

So the current behavior appears to be consistent with existing
PostgreSQL error reporting.

Regards,
Vignesh


Reply via email to