Re: select array_remove(ARRAY[NULL,NULL,NULL],NULL); returns {} instead of {NULL,NULL,NULL}
| От | Alban Hertroys |
|---|---|
| Тема | Re: select array_remove(ARRAY[NULL,NULL,NULL],NULL); returns {} instead of {NULL,NULL,NULL} |
| Дата | |
| Msg-id | 3635FE2A-A171-468C-ABFA-7EBE40B17BD1@gmail.com обсуждение исходный текст |
| Ответ на | Re: select array_length(array_remove(ARRAY[NULL,NULL,NULL],NULL), 1); returns NULL instead of 0 (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: select array_remove(ARRAY[NULL,NULL,NULL],NULL);
returns {} instead of {NULL,NULL,NULL}
|
| Список | pgsql-general |
> On 08 Aug 2016, at 20:19, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Farber <alexander.farber@gmail.com> writes:
>> I wonder, why the following returns NULL and not 0 in 9.5.3?
>
>> # select array_length(array_remove(ARRAY[NULL,NULL,NULL],NULL), 1);
>
> Because the result of the array_remove is an empty array, which is
> defined to be zero-dimensional in PG.
Reading this, I'm a bit confused about why:
select array_remove(ARRAY[NULL, NULL, NULL], NULL);
Results in:
array_remove
--------------
{}
(1 row)
How does it now which unknown value to remove from that array of unknown values? Shouldn't the result be:
{NULL,NULL,NULL}?
(Sorry for sort-of hijacking this thread)
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.
В списке pgsql-general по дате отправления: