From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Hannu Krosing" <hannu(at)2ndquadrant(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: proposal sql: labeled function params |
Date: | 2008-08-16 06:44:15 |
Message-ID: | 162867790808152344s36ccd5f3sfdd9bf9897d75f70@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
2008/8/15 Hannu Krosing <hannu(at)2ndquadrant(dot)com>:
> On Fri, 2008-08-15 at 10:01 -0400, Tom Lane wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> > Random googling shows me that Oracle appears to use a syntax like
>> > name => value
>> > This is actually a feature that I would like to see implemented soonish, so if
>> > anyone has input on the possible syntax consequences, please comment.
>>
>> We've been over this territory before. The problem with "name => value"
>> is that it requires reserving a perfectly good user-defined operator name.
>
> We could declare, that using operator => in function argument expression
> requires parenthesis : func( a => (b => c) means param a with value
> expression (b => c) nad just func((b => c)) means first param with value
> (b=>c)
>
or just use := operator?
select new_person(name := 'Smith') - it's simple and consistent with pl/pgsql.
> the main use of named params is calling functions with default values,
> and giving some params. there I'm more concerned about default args and
> rules for finding right function in presence of functions with both
> multiple args and default values for some.
>
> create function f(a int) ...
>
> create function f(a int, b int default 7)
>
> create function f(text text)
>
> and then calling f(4) - which one would it call
>
> what about f('4')
>
> Of course, we could also have default values without named params, and
> just require keyword DEFAULT where we want default value :)
>
>> "value AS name", on the other hand, accomplishes the same in a more
>> SQL-looking fashion with no new reserved word (since AS is already
>> fully reserved).
>
> would it be more natural / SQL-like to use "value AS name" or "name AS
> value" ?
>
it's question, because SQL wit AS clause don't specify value, it
specifies label.
Regards
Pavel
> -------------
> Hannu
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Meskes | 2008-08-16 08:31:56 | Re: ecpg 'set' failure using host vars |
Previous Message | Pavel Stehule | 2008-08-16 06:38:41 | Re: proposal sql: labeled function params |