Du kan gå med med en generate_series
utdata:
select
'2013-05-01'::date + g.o AS "date with offset"
from
generate_series(0, 30) AS g(o)
Utdata:
"2013-05-01"
"2013-05-02"
"2013-05-03"
...
"2013-05-29"
"2013-05-30"
"2013-05-31"
Eller... en enklare metod efter att ha definierat en ny lagrad procedur :)
CREATE OR REPLACE FUNCTION generate_series(date, date) RETURNS
SETOF date AS $$
SELECT $1 + g.s
FROM generate_series(0, ($2 - $1)) AS g(s);
$$ LANGUAGE SQL IMMUTABLE;
Kalla det bara så här:
SELECT * FROM generate_series(start_date, end_date);