Skip site navigation (1) Skip section navigation (2)

Re: variadic flag doesn't work with "any" type

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: variadic flag doesn't work with "any" type
Date: 2010-12-09 22:26:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
2010/12/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> There is missing expansion for variadic parameter from any array to
>> real parameters when variadic type is "any".
> That's not a bug, it's intentional.  Variadic any is intended to let the
> C function accept any old parameter list.  We should not assume that we
> should do something special with a parameter that happens to be an array.
> Possibly variadic anyarray will do what you are after.

I didn't explain it well, sorry

so I have a function foo(variadic "any")

usual calling like foo(10,20) or foo('a',10) working perfectly. But I
have a problem with call with VARIADIC keyword

like foo(VARIADIC ARRAY[10,20]) or foo(VARIADIC ARRAY['a','10']).

Keyword VARIADIC is allowed, and this a calling doesn't raise any
error. But there isn't transformation to standard parameters. It's in
negation to other than "any" types. And because parser doesn't expand
array to parameters and just ignore VARIADIC keyword I am must not fix
it inside custom function.


   FUNCTION foo(VARIADIC text[])
            -------- CALL foo(10,20,20) ---> real call
            -------- CALL foo (VARIADIC ARRAY['10','20','20']) --->
real call foo(ARRAY['10','20','20'])

-- same mechanism should be for "any" type - in reverse order

             -------- CALL foo(10,20,20)  ---> real call foo(10,20,20);
             -------- CALL foo(VARIADIC ARRAY[10,20,20]) ---> real
call foo(10,20,20) -- but it doesn't work now.


>                        regards, tom lane

In response to


pgsql-bugs by date

Next:From: Tom LaneDate: 2010-12-09 22:38:57
Subject: Re: variadic flag doesn't work with "any" type
Previous:From: Tom LaneDate: 2010-12-09 21:08:39
Subject: Re: variadic flag doesn't work with "any" type

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group