On Wednesday 17 December 2008 02:07:35 Tom Lane wrote:
> Oh, and another thing --- should variadic parameters be defaultable?
> The current patch doesn't allow it but it looks more like an oversight
> than anything that was thought through. The boundary case for variadic
> parameters is a bit weird already:
>
> regression=# create function fv (f1 int, f2 variadic int[]) returns int
> regression-# as 'select $1' language sql;
> CREATE FUNCTION
> regression=# select fv(1);
> ERROR: function fv(integer) does not exist
> LINE 1: select fv(1);
> ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.
That looks like a bug to me. Anything that you can do with 1 to N items
should also work for zero.
Also, in C, variadic functions are quite commonly called with zero arguments
in the variadic position.