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-10 03:35:52 |
Message-ID: | 3E6C0818.1070405@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
>>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.
>
> It'd be useful if you can reconstruct what problems you ran into.
>
I've played around a bit more and refreshed my memory -- here are two
problems:
CREATE OR REPLACE FUNCTION array_push (anyarray, any)
RETURNS anyarray
AS '$libdir/plr','array_push'
LANGUAGE 'C';
ERROR: parser: parse error at or near "any" at character 50
It seems that "any" is not accepted as a function parameter type. From
gram.y it appears that the cause is that "any" is a reserved keyword:
<snip>
/*
* Name classification hierarchy.
*
* IDENT is the lexeme returned by the lexer for identifiers that match
* no known keyword. In most cases, we can accept certain keywords as
</snip>
<snip>
/* Type identifier --- names that can be type names.
*/
type_name: IDENT { $$ = $1; }
| unreserved_keyword { $$ = pstrdup($1); }
;
</snip>
So for grins I did this:
regression=# select oid,typname from pg_type where typname like '%any%';
oid | typname
------+----------
2276 | any
2277 | anyarray
(2 rows)
regression=# update pg_type set typname = 'anyscalar' where oid = 2276;
UPDATE 1
CREATE OR REPLACE FUNCTION array_push (anyarray, anyscalar)
RETURNS anyarray
AS '$libdir/plr','array_push'
LANGUAGE 'C';
regression=# select array_push('{1,2}'::integer[],3::integer);
array_push
------------
{1,2,3}
(1 row)
So far, so good. But now the second problem:
select f1[2] from
(select array_push('{1,2}'::integer[],3::integer) as f1) as t;
ERROR: transformArraySubscripts: type anyarray is not an array
I'm just starting to dig into this one.
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-03-10 04:07:46 | Re: SQL99 ARRAY support proposal |
Previous Message | Christopher Kings-Lynne | 2003-03-10 02:33:18 | Re: Cursors and backwards scans and SCROLL |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-03-10 04:07:46 | Re: SQL99 ARRAY support proposal |
Previous Message | Tom Lane | 2003-03-09 20:55:45 | Re: SQL99 ARRAY support proposal |