I know we can use Postgres' generate_series()
function to produce a set of timestamps. Can we do the same to produce a set of time ranges directly without having to manually convert generated timestamps into time ranges like so?
SELECT tstzrange(
time_stamp,
time_stamp + '1 days'
'[)'
) AS time_range
FROM generate_series(
'2022-01-01'::TIMESTAMPTZ,
'2022-02-01'::TIMESTAMPTZ,
'1 days'
) tmp(time_stamp);