Why I can't combine %TYPE with [] ?

From: "Bruno BAGUETTE" <pgsql-ml(at)baguette(dot)net>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-ml(at)baguette(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Why I can't combine %TYPE with [] ?
Date: 2003-10-16 06:55:19
Message-ID: !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAATBuXKOMvlkWzD3KJN6FWLMKAAAAQAAAAPyj/qHfw30Wlzl/ig1YVywEAAAAA@baguette.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lanes a écrit :

> pgsql-ml(at)baguette(dot)net writes:
> > Since it's not possible to do a function with a variable number of
> > arguments, I am wondering if it is possible to use an array as an
> > argument in a PL/PGSQL function ?
>
> > CREATE OR REPLACE FUNCTION myownfunction(members.id%TYPE[],
> > events.id%TYPE) RETURNS BOOLEAN AS '
>
> You can certainly use arrays as arguments, but I don't think
> you can combine %TYPE with [] like that.

I've checked in the PostgreSQL 7.3.4 sources
(backend/parser/parse_type.c) and especially the char *
TypeNameToString(const TypeName *typename) function.

At the end of this function it seems that manages %TYPE that is combined
with [] :

if (typename->arrayBounds != NIL)
appendStringInfo(&string, "[]");

so I'm asking why I can't write a PL/PGSQL function like

CREATE OR REPLACE FUNCTION myownfunction(members.id%TYPE[],
events.id%TYPE) RETURNS BOOLEAN AS '

Am I looking at the wrong place in the sources ?

Regards,

---------------------------------------
Bruno BAGUETTE - pgsql-ml(at)baguette(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-10-16 07:47:12 Re: Getting error codes for failed queries?
Previous Message Bruno BAGUETTE 2003-10-16 06:37:15 Lost views in a PostgreSQL 7.1. dump file ?