Re: WIP: default values for function parameters

From: "Ian Caulfield" <ian(dot)caulfield(at)gmail(dot)com>
To: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-12 13:14:24
Message-ID: 27bbfebe0812120514q623f0fd4n3fd2da260d3b90bd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/12/12 David E. Wheeler <david(at)kineticode(dot)com>:
> On Dec 11, 2008, at 3:42 PM, Bruce Momjian wrote:
>
>>> what do you thing about?
>>>
>>> select fce(p1,p2,p3, SET paramname1 = val, paramname2 = val)
>>>
>>> example
>>> select dosome(10,20,30, SET flaga = true, flagb = false)
>>
>> I think AS read more naturally because you expect the parameter to come
>> first, not the SET keyword.
>
> Coming to this a bit late, but it seems to me that, while it makes sense to
> assign a label to a value using "AS", it's kind of weird to use it to assign
> a value to a label.
>
> SELECT foo( bar => 'ick', baz => 'ack' );
> SELECT foo( bar AS 'ick', baz AS 'ack' );
>
> As a Perl hacker, I'm strongly biased toward =>, but I guess AS isn't *too*
> bad. At least it's the same number of characters. Is -> right out?
>

Personally I'm not keen on named parameter assignment, but if 'AS' is
unpopular, and '=>' et al conflict with operators, would verilog-style
syntax - eg function( .param(value) ) - be an idea?

Ian

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas OSB sIT 2008-12-12 13:21:50 Re: Updates of SE-PostgreSQL 8.4devel patches (r1268)
Previous Message Tom Lane 2008-12-12 13:13:07 Re: lifetime of TubleTableSlot* returned by ExecProcNode