Re: WIP: default values for function parameters

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Grzegorz Jaskiewicz" <gj(at)pointblue(dot)com(dot)pl>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-12 14:38:54
Message-ID: 162867790812120638j558aab5aldbbf2d33684215d9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/12/12 Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>:
> David E. Wheeler wrote:
>>
>> 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' );
>
> We could do it the other way round:
>
> SELECT foo( 'ick' AS bar, 'ack' AS baz);
>

I discussed about this form with Tom.

I thing so following should be readable:

name: [ optional => ] value

SELECT foo( bar: 'ick', baz: 'ack' );
SELECT foo( bar: => 'ick', baz: => 'ack' );

or

SELECT foo( bar: = 'ick', baz: = 'ack' );

reason for optional using of "=>" is too thin char ":", so =>
optically boost the colon.

Pavel

this is 100% compatible because syntax name: is new token

> --
> Heikki Linnakangas
> EnterpriseDB http://www.enterprisedb.com
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2008-12-12 14:50:41 Re: benchmarking the query planner
Previous Message Tom Lane 2008-12-12 14:35:09 Re: benchmarking the query planner