From: Joe Conway <mail@joeconway.com>
To: Markus Bertheau ☭ <twanger@bluetwanger.de>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
Date: Mon, 06 Jun 2005 18:24:52 -0700
Message-ID: <42A4F764.9010705@joeconway.com> (raw)
In-Reply-To: <1118074367.5506.16.camel@dicaprio.akademie1.de>
References: <1116873219.7306.0.camel@localhost.localdomain>
<42923762.7010708@joeconway.com>
<16774.1116907560@sss.pgh.pa.us>
<1118067445.5506.6.camel@dicaprio.akademie1.de>
<25974.1118069089@sss.pgh.pa.us>
<1118069699.5506.9.camel@dicaprio.akademie1.de>
<42A470B5.8060007@joeconway.com>
<42A472A4.6090505@joeconway.com>
<1118074367.5506.16.camel@dicaprio.akademie1.de>
Markus Bertheau ☭ wrote:
> 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.
>
Actually I like both of these ideas, and have advocated the second one
myself before. But it isn't backward compatible -- anyone else have an
opinion? SQL2003 actually specifies that an array *should* start at 1:
4.10.2 Arrays
An array is a collection A in which each element is associated with
exactly one ordinal position in A. If n is the cardinality of A, then
the ordinal position p of an element is an integer in the range 1 (one)
≤ p ≤ n.
Joe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mail@joeconway.com, twanger@bluetwanger.de, tgl@sss.pgh.pa.us
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
In-Reply-To: <42A4F764.9010705@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox