Re: proposal sql: labeled function params

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: proposal sql: labeled function params
Дата
Msg-id 1218973899.9118.5.camel@huvostro
обсуждение исходный текст
Ответ на Re: proposal sql: labeled function params  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Ответы Re: proposal sql: labeled function params  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: proposal sql: labeled function params  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: proposal sql: labeled function params  ("Robert Haas" <robertmhaas@gmail.com>)
Список pgsql-hackers
On Sun, 2008-08-17 at 08:06 +0200, Pavel Stehule wrote:
> 2008/8/16 Decibel! <decibel@decibel.org>:
> > On Aug 15, 2008, at 1:20 PM, Hannu Krosing wrote:
> >>>
> >>> "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" ?
> >
> >
> > IMHO, *natural* would be name *something* value, because that's how every
> > other language I've seen does it.
> >
> > SQL-like would be value AS name, but I'm not a fan of putting the value
> > before the name. And I think value AS name will just lead to a ton of
> > confusion.
> >
> > Since I think it'd be very unusual to do a => (b => c), I'd vote that we
> > just go with =>. Anyone trying to do a => b => c should immediately question
> > if that would work.
> 
> I'll look on this syntax - what is really means for implementation. I
> thing, mostly of us prefer this or similar syntax.

Actually the most "natural" syntax to me is just f(name=value) similar
to how UPDATE does it. It has the added benefit of _not_ forcing us to
make a operator reserved (AFAIK "=" can't be used to define new ops)

And I still don't think we need two kinds of names ("argument name" and
"label"). I'd rather see us have the syntax for this be similar to
python's keyword arguments, even though I'm not entirely opposed to
automatically generating the name= part if it comes from existing name
(variable, function argument or column name).

---------------
Hannu




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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Replay attack of query cancel
Следующее
От: Tom Lane
Дата:
Сообщение: Re: proposal sql: labeled function params