Re: Calling PL functions with named parameters - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: Calling PL functions with named parameters
Date
Msg-id 411D4C3A.8050108@opencloud.com
Whole thread Raw
In response to Re: Calling PL functions with named parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Calling PL functions with named parameters
List pgsql-hackers
Tom Lane wrote:

>>On a related note, it would also be nice to have default
>>parameters and some way to say to use them.
> 
> 
> That is fundamentally not ever going to happen, because it blows
> overloaded-function resolution out of the water: there is no way to
> choose whether "foo(42, 2.5)" matches foo(int, float) or
> foo(int, float, something-with-a-default).  Let's try to limit our
> attention to something that might actually work.

C++ manages to solve this problem, although I can't remember the exact 
mechanics (and C++ is usually not a good example to follow anyway ;)

How about just disallowing function signatures that cause ambiguity? 
i.e. make f(t1,t2,default t3,default t4,..) lay claim to f(t1,t2), 
f(t1,t2,t3), f(t1,t2,t3,t4) etc, and creation fails if any of those 
signatures are already claimed by another function.

-O


pgsql-hackers by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: hot spare / log shipping work on
Next
From: Oliver Jowett
Date:
Subject: Re: Calling PL functions with named parameters