Re: function signature allow "default" keyword

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: function signature allow "default" keyword
Date: 2023-05-15 09:00:40
Message-ID: 29037f0c-2e24-39a7-2e74-da4e74265586@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message FOUTE K. Jaurès 2023-05-15 11:58:55 Re: PG_Cron - Error Message Connection failed
Previous Message jian he 2023-05-15 08:33:53 function signature allow "default" keyword