Re: WIP: default values for function parameters

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(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 15:06:59
Message-ID: 9FA427A6-BDA4-4E46-80FD-ADADF8297A64@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec 12, 2008, at 3:56 PM, Pavel Stehule wrote:

>> Hrm. I can see that, I guess. In that case, though, I think I'd
>> prefer the
>> colon at the beginning of the parameter label:
>>
>> SELECT foo( :bar => 'ick', :baz => 'ack' );
>
> this syntax is used yet
> http://www.postgresql.org/docs/8.3/interactive/app-psql.html
>
> testdb=> \set foo 'my_table'
> testdb=> SELECT * FROM :foo;

Oh, right. Damn.

In that case, I'm happy with your proposal of

name: [ => ] value

Where => is optional.

Or, if that just doesn't fly for reasons such as those cited by Greg
Stark, AS would seem to be the only choice left. Though what's on the
lhs vs the rhs is debatable:

SELECT foo( label AS 'value' );
SELECT foo( 'value' AS label );

Maybe they're reversible?

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-12 15:08:47 Re: benchmarking the query planner
Previous Message Simon Riggs 2008-12-12 15:06:49 Re: benchmarking the query planner