Re: SQL99 ARRAY support proposal - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SQL99 ARRAY support proposal
Date
Msg-id 10951.1047269266@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL99 ARRAY support proposal  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> It seems that "any" is not accepted as a function parameter type.

You have to double-quote it.

We could perhaps rename it to avoid the keyword conflict; I'd lean
towards "anytype" if we do ("anyscalar" seems misleading; I'd expect
that to exclude arrays).  I think I chose ANY because there was
precedent in CREATE AGGREGATE for that.

> 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

Mph.  I'm not sure we can make that work readily ... unless you want
to make the parser assume that a function taking and returning ANYARRAY
actually returns the same array type as its input is.  Otherwise the
parser has no way to determine the datatype yielded by f1[2].
        regards, tom lane


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: SQL99 ARRAY support proposal
Next
From: Hannu Krosing
Date:
Subject: Re: SQL99 ARRAY support proposal