On Wed, Dec 17, 2008 at 12:23 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > 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.
I see your point. Polymorphic + variadic is tricky. Because Postgres cannot determine the "default" type for the empty variadic anyarray argument, I think it makes sense to throw an error in this case. 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". NB I have no idea whether such an approach would be practical to implement, but I think it's the least astonishing set of behaviours. Cheers, BJ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers