From: | Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: [SQL] ARRAY() returning NULL instead of ARRAY[] |
Date: | 2005-06-06 16:12:46 |
Message-ID: | 1118074367.5506.16.camel@dicaprio.akademie1.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches pgsql-sql |
В Пнд, 06/06/2005 в 08:58 -0700, Joe Conway пишет:
> Joe Conway wrote:
> > Actually, consistent with my last post, I think array_upper() on a
> > zero-element array should return NULL. A zero-element array has a
> > defined lower bound, but its upper bound is not zero -- it is really
> > undefined.
>
> Just to clarify my response, this is what I propose:
>
> regression=# select array_upper('[2][1:]={{},{}}'::int[],1);
> array_upper
> -------------
> 2
> (1 row)
>
> regression=# select array_upper('[2][1:]={{},{}}'::int[],2) IS NULL;
> ?column?
> ----------
> t
> (1 row)
Hmm, this gets really complicated and inconsistent. Complicated means
unusable. What about modifying the dimension syntax such that the second
number means number of elements instead of upper bound? That particular
problem would go away then, and array_upper('[0:0]={}'::int[]) can
return the correct 0 then.
What I'm actually worrying about is that array_upper(array(select 1
where false)) returns 0.
An option would be to drop the possibility to let the array start at
another index than 0. I don't know why it was decided to do that in the
first place. It seems a rather odd feature to me.
Markus
--
Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de>
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2005-06-06 16:13:19 | Re: Quick-and-dirty compression for WAL backup blocks |
Previous Message | David Fetter | 2005-06-06 16:10:40 | Re: regexp_replace |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-06-06 16:34:39 | Re: pg_starttime() |
Previous Message | David Fetter | 2005-06-06 16:10:40 | Re: regexp_replace |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-06-06 16:21:00 | Re: How do write a query... |
Previous Message | Richard Huxton | 2005-06-06 16:09:55 | Re: What is faster? |