I know we can use Postgres's generate_series()
function to produce a list of timestamps. Can we do the same to produce a list 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);