Re: function signature allow "default" keyword - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: function signature allow "default" keyword
Date
Msg-id 29037f0c-2e24-39a7-2e74-da4e74265586@gmx.net
Whole thread Raw
In response to function signature allow "default" keyword  (jian he <jian.universality@gmail.com>)
Responses Re: function signature allow "default" keyword
List pgsql-general
jian he schrieb am 15.05.2023 um 10:33:
>
> function idea.
> allow function calling using the default keyword for any of the input arguments.
>
> example: https://dbfiddle.uk/FQwnfdmm
> So something like this "SELECT * FROM customer_orders(2579927, 'order_placed_on DESC', default, 2);"
> should work.


You can use named parameters when calling the function, that will use the default value for those not mentioned:

SELECT *
FROM customer_orders(_customer_id => 2579927,
                     _sort_field_and_direction => 'order_placed_on DESC',
                     _offset => 2);




pgsql-general by date:

Previous
From: jian he
Date:
Subject: function signature allow "default" keyword
Next
From: FOUTE K. Jaurès
Date:
Subject: Re: PG_Cron - Error Message Connection failed