Re: Misplaced double quotes in error message

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Misplaced double quotes in error message
Дата
Msg-id 55189.1633618509@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Misplaced double quotes in error message  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Misplaced double quotes in error message  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Список pgsql-general
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 10/6/21 11:17 PM, Thomas Kellerer wrote:
>> consider the following table, query and error message:
>> ERROR: column t.somecolumn does not exist
>> Hint: Perhaps you meant to reference the column "t.someColumn".
>>
>> For someone proficient in SQL it's pretty clear what the error message means,
>> but the quotes can be misleading for someone who doesn't really understand
>> what's going on.

> FYI, errors are generically double quoted:
> ERROR:  invalid input syntax for type integer: "one"
> This is not specific to identifier quoting.

Yeah.  This is not as simple as it looks, because per our message
style guidelines, double quotes are used to set off inserted text,
independently of whether it is a SQL identifier or something else.
(There is a style violation in this message: the occurrence of
t.somecolumn in the primary message should've been quoted too.)

In translated error messages, the English double quotes are replaced
with whatever the common quoting marks are in that language.  So
for instance in French this becomes

ASTUCE :  Peut-être que vous souhaitiez référencer la colonne « t.someColumn ».

where it's at least clearer that the set-off marks are not meant to be
copied into a SQL statement.

In short, what we've got here is unfortunate confusion between the meaning
of double quotes in ordinary English and their meaning in SQL.  People
complain about this topic every so often, but I've not yet seen a proposal
that would improve matters.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: AW: how to merge two postgresql server instances into one
Следующее
От: Nikhil Benesch
Дата:
Сообщение: Re: DELETE ... USING LATERAL