Re: Inconsistent behavior on Array & Is Null?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inconsistent behavior on Array & Is Null?
Дата
Msg-id 24111.1080892418@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inconsistent behavior on Array & Is Null?  (Greg Stark <gsstark@mit.edu>)
Ответы Re: Inconsistent behavior on Array & Is Null?  (Greg Stark <gsstark@mit.edu>)
Re: Inconsistent behavior on Array & Is Null?  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> array_lower() and array_upper() are returning NULL for a non-null
> input, the empty array, even though lower and upper bounds are known
> just as well as they are for any other sized array. They are behaving
> as if there's something unknown about the empty array that makes it
> hard to provide a lower bound or upper bound.

Hm.  My idea of the index lower bound is "the smallest index for which
there is an array member" --- so I agree with Joe that it's not very
well defined for an empty array.  We could pick some arbitrary value,
such as zero, for the LB and UB to be reported for an empty array, but
I can't see any way that you could justify them except as arbitrary
choices.

I think that maybe we ought to question these two properties:* empty array is different from NULL ... really?  Why?*
storinga value into an element of a NULL array yields  a NULL array instead of a singleton array.
 
IIRC the latter is presently true because we couldn't figure out
just what dimensionality to assign, but it might be easier to agree on
that than to resolve these other arguments...
        regards, tom lane


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Inconsistent behavior on Array & Is Null?
Следующее
От: "Zeugswetter Andreas SB SD"
Дата:
Сообщение: Re: pre-loading a user table.