2009/10/7 Tom Lane <[email protected]>: > Pavel Stehule <[email protected]> writes: >>> Sorry, I'm having trouble understanding what you're driving at here. >>> I think we should just not allow named notation to be combined with >>> VARIADIC, at least for a first version of this feature, either when >>> defining a function or when calling one. We can consider relaxing >>> that restriction at a later date if we can agree on what the semantics >>> should be. > >> This is maybe too strict. I thing, so safe version is allow variadic >> packed parameter with VARIADIC keyword as Jeff proposes. > > I'm working through this patch now, and I find myself not very satisfied > on the question of variadic versus named arguments. What the latest > patch actually does is: > > * completely ignores variadic functions when trying to match > a call having any named arguments > > * does not throw an error for use of the VARIADIC keyword > in a call together with named arguments > > Neither of these behaviors quite seem to me to satisfy the principle of > least astonishment, and in combination they definitely do not. > > It seems to me that there is not anything wrong with using named > arguments together with VARIADIC and getting a match to a variadic > function. VARIADIC in the argument list essentially turns off the > special behavior of variadic functions, and after that you might as > well allow either named or positional matching. (I guess if you > wanted to be really strict you'd insist that the VARIADIC keyword > be attached to the specific named argument that matches the variadic > parameter, but I don't mind being a bit lax there.) > > When VARIADIC is not specified, then I think that silently ignoring > variadic functions for a named-argument call is probably reasonable. > This can be argued by imagining that the function's implicit array > element parameters do not have any names (the variadic array parameter > might have a name, but the elements generated from it do not). Since > these must be at the right end of the effective parameter list, and we > only allow named arguments at the right of the call list, there is no > way for the named arguments to match non-variadic named parameters and > still have anything matching to the variadic array elements. Therefore > a variadic function can never match such a call and ignoring it isn't > surprising.
It's same as my origin ideas, much better formulated. It is ok for me. Pavel > > Comments? > > regards, tom lane > -- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
