| От | Tom Lane |
|---|---|
| Тема | Re: ARRAY_LENGTH() function behavior with empty array |
| Дата | |
| Msg-id | 28740.1480692031@sss.pgh.pa.us обсуждение |
| Ответ на | ARRAY_LENGTH() function behavior with empty array (otar shavadze <oshavadze@gmail.com>) |
| Ответы |
Re: ARRAY_LENGTH() function behavior with empty array
|
| Список | pgsql-general |
otar shavadze <oshavadze@gmail.com> writes:
> SELECT ARRAY_LENGTH('{}'::INT[], 1)
> This returns NULL, not so "dangerous" either way, not would be more
> logically, if array length function will return 0 from empty array,
> instead of NULL ?
Well, the issue is that you're asking about dimension 1 of a
zero-dimensional array, so the answer is indeed undefined, not 0.
A lot of people are not terribly happy with PG's array handling,
but there's enough interconnectedness to the behaviors that it's
hard to change just one thing ... and there's also backwards
compatibility to worry about.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера