Re: SQL99 ARRAY support proposal

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 20:12:55
Message-ID: 3E6BA047.7000305@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> By analogy to the "type 'literal'" syntax? I'd prefer not to go that
> route, because that syntax for literals is a horrid kluge --- to keep
> bison from spitting up, we've had to put a bunch of nasty restrictions
> on the type names that can appear in such constructs. All those
> restrictions would have to apply here, too.
>
> It's possible that we could use the other cast syntaxes:
> ARRAY[1,2,3]::integer[]
> CAST(ARRAY[1,2,3] AS integer[])
> It would take some hackery to propagate the destination type down into
> the ARRAY[] before the latter's type resolution is done, but at least
> it'd be a quite localized hack.

OK -- I'll try to make that work. I presume that in the non-specified
case "ARRAY[1,2,3]" I should use something similar to UNION's resolution
rules?

>><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>
>
> This I could live with --- note the difference in punctuation. There
> would be a clear syntactic and semantic difference between
> ARRAY(SELECT ...) and ARRAY[(SELECT ...)].

Sorry -- I guess I mis-read that. So "ARRAY(SELECT ...)" it is.

> [...lots of good ideas regarding generalizing array operations...]

I played with generalizing array functions a bit for plr and ran into
some problems (which I can't specifically recall at the moment), but
clearly that's the way to go. I'll start playing with your suggestions
in C code, and report back for more feedback as it solidifies.

Thanks!

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-09 20:35:11 Cursors and backwards scans and SCROLL
Previous Message Tom Lane 2003-03-09 20:03:51 DECLARE CURSOR to become utility statement

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-03-09 20:55:45 Re: SQL99 ARRAY support proposal
Previous Message Tom Lane 2003-03-09 18:58:48 Re: SQL99 ARRAY support proposal