Re: proposal sql: labeled function params

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: proposal sql: labeled function params
Дата
Msg-id 1218909144.7387.28.camel@huvostro
обсуждение исходный текст
Ответ на Re: proposal sql: labeled function params  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Ответы Re: proposal sql: labeled function params
Список pgsql-hackers
On Sat, 2008-08-16 at 08:44 +0200, Pavel Stehule wrote:
> Hello

> >> "value AS name", on the other hand, accomplishes the same in a more
> >> SQL-looking fashion with no new reserved word (since AS is already
> >> fully reserved).
> >
> > would it be more natural / SQL-like to use "value AS name" or "name AS
> > value" ?
> >
> 
> it's question, because SQL wit AS clause don't specify value, it
> specifies label.

A "label" is the same thing as "variable"/"attribute"/"argument name" in
all  programming languages I can think of. Why do you need two kinds of
argument names in postgreSQL ?

maybe you are after something like keyword arguments in python ?

http://docs.python.org/tut/node6.html#SECTION006720000000000000000

keyword arguments are a way of saying that you don't know all variable
names (or "labels" if you prefer) at function defining time and are
going to pass them in when calling. 

It's kind of extended variadic argument, only with names and types for
each extra arg. 

Of course we could extend this to have shortcut of passing in original
variable or field names automatically, without you having to explicitly
write it down that is fun(name) instead of fun(name=name) but I'm not
sure it is actually a good idea. SQL in general has not been very terse
language. 

But I sure would like to have the flexibility of keyword arguments in
PostgreSQL .


> Regards
> Pavel
> 
> 
> > -------------
> > Hannu
> >
> >
> >



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: proposal sql: labeled function params
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Replay attack of query cancel