From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Peter Eisentraut" <peter_e(at)gmx(dot)net> |
Cc: | Decibel! <decibel(at)decibel(dot)org>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: array_length() |
Date: | 2008-11-05 14:24:36 |
Message-ID: | 162867790811050624o164ca7e9n81134ec86b8e3894@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2008/11/5 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> Pavel Stehule wrote:
>>
>> Hello
>>
>> 2008/11/5 Peter Eisentraut <peter_e(at)gmx(dot)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.
>
> Well, isn't isempty() just a special case of array_length()? One or the
> other needs to be implemented, so we might as well go for the general case,
> IMO.
>
sure, but I believe so 90% of using array_length will be test of emty array.
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Mayer | 2008-11-05 14:39:30 | Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle |
Previous Message | Fujii Masao | 2008-11-05 14:17:14 | Walsender process patch v1 for Synch Rep |