Re: WIP: default values for function parameters

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: WIP: default values for function parameters
Дата
Msg-id 603c8f070812120622r64966fdel210187cb728e947@mail.gmail.com
обсуждение исходный текст
Ответ на Re: WIP: default values for function parameters  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers
> I'm okay with AS if that's the way it has to be, but what about a colon
> right at the end of the label? A cast is two colons, so no conflict there:
>
>  SELECT foo(1, name: 'bar', quantity: 10);
>
> No doubt I'm missing something…

I'd just like to mention that there are two different cases to
consider here.  One is when you want to pass some optional parameters,
but there are enough of them that it's inconvenient to have them in
some particular order.  This is the case I think you're primarily
catering to here.

The other is when you want the function that gets called to magically
know what name the system would have assigned to the column had the
expression been used in a select list, so that you can write things
xmlify(foo) and get <foo>...data from foo...</foo>.

I think the AS syntax makes a lot of sense for the second one, but not
so much for the first one.  Maybe we need both:

[keyword:] paramater_expression [AS label]

...Robert


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: WIP: default values for function parameters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: benchmarking the query planner