Search Postgresql Archives

Re: select array_remove(ARRAY[NULL,NULL,NULL],NULL); returns {} instead of {NULL,NULL,NULL}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 08 Aug 2016, at 20:19, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
> 
> Alexander Farber <alexander.farber@xxxxxxxxx> 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.



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux