Re: array_in sub function ReadArrayDimensions error message

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: array_in sub function ReadArrayDimensions error message
Дата
Msg-id 1386373.1720539082@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: array_in sub function ReadArrayDimensions error message  (jian he <jian.universality@gmail.com>)
Ответы Re: array_in sub function ReadArrayDimensions error message
Re: array_in sub function ReadArrayDimensions error message
Список pgsql-hackers
jian he <jian.universality@gmail.com> writes:
> On Mon, Jul 8, 2024 at 10:42 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> One possibility could be
>> ...
>> that is, only say "Missing "]"" if there's no ']' anywhere, and
>> otherwise just say the dimensions are wrong.  This could be fooled
>> by a ']' that's part of some string in the data, but even then the
>> errdetail isn't wrong.
>> 
>> Or we could just say "Array dimensions have invalid syntax."
>> unconditionally.

> please check attached.

Meh.  This just replaces one possibly-off-point error message
with a different one that will be off-point in a different set
of cases.  I think we should simply reduce the specificity of
the message.

BTW, I think we have pretty much the same issue with respect
to the check for "=" later on.  For instance, if someone
is confused about whether to insert commas:

=# select '[1:1],[1:2]={{3,4}}'::int[];
ERROR:  malformed array literal: "[1:1],[1:2]={{3,4}}"
LINE 1: select  '[1:1],[1:2]={{3,4}}'::int[];
                ^
DETAIL:  Missing "=" after array dimensions.

Here again, the problem is not a missing "=", it's invalid
syntax somewhere before that.

Another thing we could consider doing here (and similarly
for your original case) is

DETAIL:  Expected "=" not "," after array dimensions.

The advantage of this is that it provides a little more
clarity as to exactly where things went wrong.

            regards, tom lane



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

Предыдущее
От: Junwang Zhao
Дата:
Сообщение: Re: jsonpath: Inconsistency of timestamp_tz() Output
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: tests fail on windows with default git settings