Re: Variadic parameters vs parameter defaults

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Variadic parameters vs parameter defaults
Дата
Msg-id 18517.1229475988@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Variadic parameters vs parameter defaults  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> I'm inclined to think an implicit empty array makes the most sense. If a
> function-writer wants to enforce a minimum number of arguments they can check
> and throw an error.

> The question arises though whether it's useful to have any default other than
> an empty array. I don't see a compelling reason.

I'm not sure if that's useful either.  However, I think there are
probably quite a lot of cases where an empty array *isn't* desirable,
and so letting the current behavior alone seems okay, so long as there's
a way to override that and specify default = empty array when you do
want it to be possible.

The other way seems to boil down to "a variadic parameter has an
implicit default that you're not allowed to override", which doesn't
seem tremendously attractive.
        regards, tom lane


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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: Coding TODO for 8.4: Synch Rep
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Another issue in default-values patch: defaults expanded too soon