On Wednesday 17 December 2008 06:03:06 Tom Lane wrote:
> "Brendan Jurd" <direvus@gmail.com> writes:
> > So if I had these two functions ...
> >
> > var1(a int, b variadic int[])
> > var2(a int, b variadic anyarray)
> >
> > ... it would be okay to write var1(8), which resolves as var1(8,
> > array[]::int[]). But if I tried to write var2(8) I'd get an error.
> > Maybe something like "cannot determine type of missing variadic
> > arguments".
>
> Well, we could unify these behaviors if we insisted on an explicit
> default to omit the argument in both cases.
>
> var1(a int, b variadic int[] default '{}'::int[])
> var2(a int, b variadic anyarray default '{}'::text[]) -- perhaps
I would just pass an empty array if the type is clear and error out otherwise.
Mixing these things up makes things a lot more complicated for even normal
uses.