Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Дата
Msg-id 25974.1118069089@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}  (Markus Bertheau ☭ <twanger@bluetwanger.de>)
Ответы Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Список pgsql-hackers
Markus Bertheau ☭ <twanger@bluetwanger.de> writes:
> By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of
> NULL.

No, that doesn't follow ... we've traditionally considered '{}' to
denote a zero-dimensional array.  A 1-D array of no elements is
'[1:0]={}', just as Joe shows ... or at least it would be except
for an overenthusiastic error check:

regression=# select '[1:0]={}' :: int[];
ERROR:  upper bound cannot be less than lower bound

I think this should be a legal boundary case.  In general, it should be
possible to form zero-size arrays of any number of dimensions.
        regards, tom lane


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

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: thw rewriter and default values, again
Следующее
От: "Jonah H. Harris"
Дата:
Сообщение: Re: Solution proposal for TODO item "Clients: sequences"