generate_series
で参加できます 出力:
select
'2013-05-01'::date + g.o AS "date with offset"
from
generate_series(0, 30) AS g(o)
出力:
"2013-05-01"
"2013-05-02"
"2013-05-03"
...
"2013-05-29"
"2013-05-30"
"2013-05-31"
または...新しいストアドプロシージャを定義した後のより簡単な方法:)
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;
このように呼んでください:
SELECT * FROM generate_series(start_date, end_date);