Search Postgresql Archives

Re: Default values in functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, December 29, 2021, Michael Lewis <mlewis@xxxxxxxxxxx> 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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux