From: | Guy Fraser <guy(at)incentre(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: array_dims array_lower/upper distance |
Date: | 2005-09-22 20:16:48 |
Message-ID: | 1127420208.4437.13.camel@sigurd.incentre.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 2005-22-09 at 12:43 -0400, Greg Stark wrote:
> Guy Fraser <guy(at)incentre(dot)net> writes:
>
> > So to answer his question he would likely want :
> >
> > SELECT
> > array_upper(item,1) - array_upper(item,0) + 1 as elements
> > FROM
> > arraytest ;
>
> Note that this doesn't work for empty arrays.
> It will return NULL instead of 0.
Your response was not at all helpfull, I would like to
encourage you to expand on what I put off the top of my
head.
I have not used array_upper() before, and the question was
how to return the total number of elements, not how to
handle NULL and empty arrays.
One could construct a fully logic compliant routine using
CASE and IF NULL to generate the type of response you want
when checking empty or NULL arrays.
If you have something to add then provide details. If you
are just trying to seem like you know more than everyone
else then don't bother posting.
From | Date | Subject | |
---|---|---|---|
Next Message | Emi Lu | 2005-09-22 20:40:55 | Re: Questions about Rollback - after insert, update, |
Previous Message | Scott Marlowe | 2005-09-22 20:02:58 | Re: Questions about Rollback - after insert, update, |