Re: array_length() - Mailing list pgsql-hackers

From Decibel!
Subject Re: array_length()
Date
Msg-id 4DCC69BA-ECEE-48B8-9F09-20DCA09A7C56@decibel.org
Whole thread Raw
In response to Re: array_length()  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On Nov 5, 2008, at 7:00 AM, Peter Eisentraut wrote:
> There is a tiny problem with this implementation: It returns null  
> for an empty array, not zero.  This is because array_lower and/or  
> array_upper return null for an empty array, which makes sense for  
> those cases.  We could fix this by putting a coalesce around the  
> expression, but since the array functions return null for all kinds  
> of error cases, this might mask other problems.


What other error conditions? If we hit a real error, we should throw  
an error.

Granted, there is some debate possible about what referencing an un- 
defined dimension means, but I can't see how the results of that  
should vary between array_length and array_lower/upper.

Is there some other corner case?
-- 
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828




pgsql-hackers by date:

Previous
From: Decibel!
Date:
Subject: Re: ALTER DATABASE SET TABLESPACE vs crash safety
Next
From: "Hitoshi Harada"
Date:
Subject: Re: Windowing Function Patch Review -> ROW_NUMBER without ORDER BY