pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Miscellaneous message fixes
Date: Tue, 10 Feb 2026 09:55:23 -0500
Message-ID: <3706800.1770735323@sss.pgh.pa.us> (raw)
In-Reply-To: <202602101023.p75nm75pl7jh@alvherre.pgsql>
References: <202602101023.p75nm75pl7jh@alvherre.pgsql>

=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@kurilemu.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





view thread (11+ messages)  latest in thread

Message-ID: <3706800.1770735323@sss.pgh.pa.us>
Permalink:  ../3706800.1770735323@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3706800.1770735323@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@kurilemu.de, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Miscellaneous message fixes
  In-Reply-To: <3706800.1770735323@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox