Re: WIP: default values for function parameters - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: WIP: default values for function parameters
Date
Msg-id 9FA427A6-BDA4-4E46-80FD-ADADF8297A64@kineticode.com
Whole thread Raw
In response to Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List 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


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: WIP: default values for function parameters
Next
From: Tom Lane
Date:
Subject: Re: WIP: default values for function parameters