| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Miscellaneous message fixes |
| Date: | 2026-02-10 14:55:23 |
| Message-ID: | 3706800.1770735323@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre(at)kurilemu(dot)de> writes:
> On 2026-Feb-10, Kyotaro Horiguchi wrote:
>> In extended_stats_funcs.c:
>>> errmsg("could not find extended statistics object \"%s\".\"%s\"",
>>> quote_identifier(nspname),
>>> quote_identifier(stxname)));
>>
>> Since quote_identifier() already adds quoting when needed, adding
>> "%s"."%s" in the format string results in double quoting. It would be
>> better to use %s.%s instead. I think quoting should be applied only
>> when necessary here. I'm not sure we should use
>> quote_qualified_identifier() instead.
> Hmm, in the vast majority of messages, the quotes are in the literal
> string, and we do not add quote_identifier(). This way, the names are
> always quoted, not just when they are funny identifiers; also the
> translator chooses the quoting style they want, which is not necessarily
> the same as the one used in English.
Yeah, this code is simply wrong. You should remove the
quote_identifier() calls and otherwise leave it as-is.
quote_identifier(), quote_qualified_identifier(), etc are meant for
building valid SQL strings. However, an error message is a totally
different animal. We decided years ago that the preferred style is
to wrap "..." around the unadorned identifier *in the error text*,
not by using quote_identifier(), so that translators could replace
the double-quote marks with appropriate marks for their language.
Is the English version 100% consistent in the presence of identifiers
containing double-quote marks? No. But we'd be making matters
worse not better for other languages if we did it differently.
This choice is documented at
https://www.postgresql.org/docs/devel/error-style-guide.html#ERROR-STYLE-GUIDE-QUOTATION-MARKS
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniil Davydov | 2026-02-10 15:03:45 | Re: POC: Parallel processing of indexes in autovacuum |
| Previous Message | Robert Haas | 2026-02-10 14:54:30 | Re: Add 64-bit XIDs into PostgreSQL 15 |