testdb=# select dt::date d from generate_series(current_date - interval '7 days', current_date - interval '1 days', interval '1 days') dt;
d
------------
2020-06-10
2020-06-11
2020-06-12
2020-06-13
2020-06-14
2020-06-15
2020-06-16
(7 rows)
Или в виде массива / строки:
testdb=# select array_agg(dt::date) last_7d from generate_series(current_date - interval '7 days', current_date - interval '1 days', interval '1 days') dt;
last_7d
--------------------------------------------------------------------------------
{2020-06-10,2020-06-11,2020-06-12,2020-06-13,2020-06-14,2020-06-15,2020-06-16}
(1 row)
testdb=# select array_to_string(array_agg(dt::date), ',') last_7d from generate_series(current_date - interval '7 days', current_date - interval '1 days', interval '1 days') dt;
last_7d
------------------------------------------------------------------------------
2020-06-10,2020-06-11,2020-06-12,2020-06-13,2020-06-14,2020-06-15,2020-06-16
(1 row)