Postgresql – Split time range into range for whole days and the remaining hours before / after
In Postgres, given a collection of date ranges like: meter_id device_id start_at end_at meter1 device1 2020-01-02 10:30 2025-01-02 14:00 meter2 device1 2020-01-02 10:30 2020-01-02 11:30 meter3 device1 2020-01-02 10:30 2020-01-03 11:30 I want to bucket the ranges into: a range…