Re: Default values in functions

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Default values in functions
Дата
Msg-id CAKFQuwb4peZMzcsBnDj24Y0jRvPprfoebnP9+j9kuv9wL92xmg@mail.gmail.com
обсуждение исходный текст
Ответ на Default values in functions  (Michael Lewis <mlewis@entrata.com>)
Ответы Re: Default values in functions  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general
On Wednesday, December 29, 2021, Michael Lewis <mlewis@entrata.com> wrote:

If I can somehow pass "use default for this parameter" to functions like I can for insert statements, then that would be great to know.


There is not.
 

Generally, the use case I am looking at is having a function with a few required parameters leading and then many optional and I'd like to ensure the optional ones get the default set if a value is used that "is not distinct from null" basically.


That isn’t how it works.  Absence is what is important.  Null is not absence.  As you showed, if you want nulls to be converted to defaults you can use coalesce.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Default values in functions
Следующее
От: Michael Lewis
Дата:
Сообщение: Re: Default values in functions