David Fetter <david@fetter.org> writes:
> CREATE OR REPLACE FUNCTION foo_func(name TEXT, val INTEGER) AS ...
> SELECT foo_func(val AS 23, name AS 'Name goes here');
I don't think that syntax will work. You could possibly do it the other
way round:
SELECT foo_func(23 AS val, 'Name goes here' AS name);
which would have some commonality with SELECT's column-labeling syntax
but otherwise seems to have little to recommend it. Are there any other
vendors supporting such things in SQL, and if so how do they do it?
A bigger issue is how do you see this interacting with resolution of
ambiguous/overloaded function names.
> 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.
regards, tom lane