Re: array_length()

From: Decibel! <decibel(at)decibel(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: array_length()
Date: 2008-11-10 00:31:45
Message-ID: 4DCC69BA-ECEE-48B8-9F09-20DCA09A7C56@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2008-11-10 00:38:58 Re: Windowing Function Patch Review -> ROW_NUMBER without ORDER BY
Previous Message Decibel! 2008-11-10 00:25:50 Re: ALTER DATABASE SET TABLESPACE vs crash safety