Använd funktionen generate_series(start, stop, step interval)
, t.ex.:
select d::date, coalesce(total, 0) as total
from generate_series('2018-01-01', '2018-01-31', '1 day'::interval) d
left join my_table t on d::date = t.date
Fungerande exempel i rextester.