Re: Should array_length() Return NULL
| От | Tom Lane |
|---|---|
| Тема | Re: Should array_length() Return NULL |
| Дата | |
| Msg-id | 413.1363385237@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Should array_length() Return NULL ("David E. Wheeler" <david@justatheory.com>) |
| Ответы |
Re: Should array_length() Return NULL
Re: Should array_length() Return NULL |
| Список | pgsql-hackers |
"David E. Wheeler" <david@justatheory.com> writes:
> This surprised me:
> david=# select array_length('{}'::text[], 1);
> array_length
> --------------
> [null]
> I had expecte dit to retur 0. I might expect NULL for a NULL param, but not one that's defined but has no elements.
The thing is that that syntax creates an array of zero dimensions,
not one that has 1 dimension and zero elements. So "0" would be
incorrect.
Our handling of empty arrays leaves something to be desired, I agree,
but making it more consistent seems like a large task. Hacking
array_length in isolation will certainly not help.
regards, tom lane
В списке pgsql-hackers по дате отправления: