Re: variadic flag doesn't work with "any" type
От | Pavel Stehule |
---|---|
Тема | Re: variadic flag doesn't work with "any" type |
Дата | |
Msg-id | AANLkTinU-jsNCiL9XUgnfatKZTixvSxWeG1N35XBfR2S@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: variadic flag doesn't work with "any" type (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: variadic flag doesn't work with "any" type
|
Список | pgsql-bugs |
2010/12/9 Tom Lane <tgl@sss.pgh.pa.us>: > Pavel Stehule <pavel.stehule@gmail.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. =C2=A0Variadic any is intended to let= the > C function accept any old parameter list. =C2=A0We 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. so: FUNCTION foo(VARIADIC text[]) -------- CALL foo(10,20,20) ---> real call foo(ARRAY['10','20','20']); -------- CALL foo (VARIADIC ARRAY['10','20','20']) ---> real call foo(ARRAY['10','20','20']) -- same mechanism should be for "any" type - in reverse order FUNCTION foo(VARIADIC "any") -------- 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. Pavel > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0regards, tom lane >
В списке pgsql-bugs по дате отправления: