From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SQL99 ARRAY support proposal |
Date: | 2003-03-09 05:06:19 |
Message-ID: | 3E6ACBCB.5080401@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>>select ARRAY[1,2,3];
>> result '{1,2,3}'
>
> The array type is determined how? I'd like this syntax better if there
> were a way to force the choice of array type...
What about:
select integer ARRAY[1,2,3];
result '{1,2,3}'::integer[]
>>select ARRAY[(select oid from pg_class order by relname)];
>> result is array of all the oid's in pg_class in relname order
>
> Puh-leez tell me that's not in the spec. How is one supposed to
> distinguish this usage from the scalar-subselect case?
Well, SQL99 has this:
<array value constructor> ::=
<array value list constructor>
<array value list constructor> ::=
ARRAY <left bracket or trigraph>
<array element list>
<right bracket or trigraph>
but SQL200x has this:
<array value constructor> ::=
<array value constructor by enumeration> |
<array value constructor by query>
<array value constructor by enumeration> ::=
ARRAY <left bracket or trigraph>
<array element list>
<right bracket or trigraph>
<array value constructor by query> ::=
ARRAY <left paren>
<query expression> [ <order by clause> ]
<right paren>
>>select ARRAY[1,2] || 3
>> result '{1,2,3}'
>
>
> Datatypes?
maybe?
select integer ARRAY[1,2] || 3
result '{1,2,3}'::integer[]
> How many variants of the || operator do you plan to offer?
One for each builtin datatype[]/datatype pair (e.g. integer[]/integer),
and another for each datatype[] (e.g. integer[]/integer[])
> What will be the side-effects on the parser's ability to pick one?
Not really sure. I figured I'd cross that bridge when I got to it. Are
there specific landmines you're thinking of in there?
>>select ARRAY[1,2] || ARRAY[3,4]
>> result '{1,2,3,4}'
select integer ARRAY[1,2] || integer ARRAY[3,4]
result '{1,2,3,4}'::integer[]
Or else the use UNION's algorithm for deriving the element type (you
suggested this previously, but I may have misunderstood)
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Dennis Björklund | 2003-03-09 06:52:24 | Re: website charset |
Previous Message | Justin Clift | 2003-03-09 04:54:50 | Re: [GENERAL] division by zero |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2003-03-09 05:37:06 | Re: Dump CLUSTER in pg_dump |
Previous Message | Alvaro Herrera | 2003-03-09 05:01:15 | Re: Dump CLUSTER in pg_dump |