Re: array_length() - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: array_length()
Date
Msg-id 162867790811050514y7dfca722oce4cd44ea5e76a4@mail.gmail.com
Whole thread Raw
In response to Re: array_length()  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: array_length()  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Hello

2008/11/5 Peter Eisentraut <peter_e@gmx.net>:
> Decibel! wrote:
>>
>> ISTM it'd be useful to have an array_length function (since I just wrote
>> one for work ;), so here's a patch. Note that I don't have the docs
>> toolchain setup, so I wasn't able to test the doc patches.
>
> 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.  Or we move to a C implementation.
>

we should to write function isempty(anyarray), that returns true when
param is empty.

regards
Pavel Stehule




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


pgsql-hackers by date:

Previous
From: Gianni Ciolli
Date:
Subject: Re: usermap regexp support
Next
From: Joshua Tolley
Date:
Subject: Re: Proposed Patch to Improve Performance of Multi-Batch Hash Join for Skewed Data Sets