Wolfgang Walther <walther@technowledgy.de> writes:
> create function b(x int, variadic y int[] default '{}')
> returns void language sql as '';
> select b(x=>1, variadic y=>'{2}');
> [ ok ]
> select b(x=>1);
> ERROR: function b(x => integer) does not exist
> I could not find anything in the documentation that points this out as a
> limitation, so I expected this to work. Did I miss anything?
You can't write positional arguments after named arguments, so the
failure to match isn't all that surprising; that is, to accept this
call we'd have to interpret it as a named argument and then an empty
list of things to match positionally to the variadic parameter.
Perhaps a better error message could be wished for, but given the
current rules this can't succeed.
One could imagine saying that if the function has a variadic last
parameter, then we can match that to zero or more positional arguments
after the last named argument. Not sure that that would be a good
idea though, or how hard it'd be to implement. It'd be a pretty
radical departure from the rules for non-variadic functions.
regards, tom lane