I have some sparse date-related data in Postgres, and I want to extract a report that has a complete date range (even if there is no related data). I want to do the equivalent of a left outer join between a (non-existent) table of all dates in a range, and the data table that I have, i.e.
SELECT temp_dates.date, data_table.data_field
FROM temp_dates
LEFT OUTER JOIN data_table
ON temp_dates.date = data_table.data
My question is - how do I do create the temp table with the full range of dates?
NB I've asked about temp tables as I understand them, however if there is a better way (e.g. joining a table to an array, for instance), then I'd really like to know.