"David E. Wheeler" <da...@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


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

Reply via email to