Does anyone know if it's possible to use a generate_series function as a default value for a function?
current_date works fine but would also like to specify a value range by default but get the set-returning function are not allow in default expressions. In this scenario, it would sure be nice to insert a default value not to fire off some unbounded query. I suppose you could add logic in the function itself???
CREATE OR REPLACE FUNCTION foo(
start_date date DEFAULT current_date
, end_date date DEFAULT (current_date - interval '60 days')
, sites int[] DEFAULT (generate_series(1, 10, 1))
, details bool DEFAULT false
) RETURNS text
AS $$
select 'foo'
$$ LANGUAGE SQL;
select foo();