Re: Variadic parameters vs parameter defaults
От | Tom Lane |
---|---|
Тема | Re: Variadic parameters vs parameter defaults |
Дата | |
Msg-id | 18723.1229477029@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Variadic parameters vs parameter defaults ("Brendan Jurd" <direvus@gmail.com>) |
Ответы |
Re: Variadic parameters vs parameter defaults
|
Список | pgsql-hackers |
"Brendan Jurd" <direvus@gmail.com> writes: > On Wed, Dec 17, 2008 at 11:07 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> ISTM one could make a pretty good argument that this last case should >> succeed, producing an empty-array argument. If you buy that, then it >> is sensible to forbid defaults for variadics, > Yep, +1 for this approach. I would intuitively expect that, if I omit > variadic argument(s) when calling a function, that the function ends > up getting an empty array of the appropriate type. Actually, I just realized that there's another fly in the ointment: the current variadic code allows "variadic anyarray", which is equivalent to an appropriate number of anyelement arguments. If we allow defaulting then there's a big problem: no principled way to decide what type the empty array is. The explicit-default solution would work around that, by making the user say what type he wants. However it puts us right back into the situation of having a default for a polymorphic argument, which I was hoping to avoid. regards, tom lane
В списке pgsql-hackers по дате отправления: