-- -- // This code comes from http://code.calum.org/ -- Name: get_days(date, date); Type: FUNCTION; Schema: public; Owner: calum -- CREATE FUNCTION get_days(date, date) RETURNS SETOF date AS $_$declare r RECORD; begin for r in SELECT ($1 + s.t) AS dates FROM generate_series(0,($2 - $1)) AS s(t) loop return next r; end loop; return; end $_$ LANGUAGE plpgsql;