Re: WIP: default values for function parameters

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: WIP: default values for function parameters
Дата
Msg-id 9FA427A6-BDA4-4E46-80FD-ADADF8297A64@kineticode.com
обсуждение исходный текст
Ответ на Re: WIP: default values for function parameters  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: Re: WIP: default values for function parameters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: default values for function parameters