Use a função
generate_series(start, stop, step interval)
, por exemplo.: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
Exemplo de trabalho no rextester.