New answers tagged

0

Your problem here is that your data model is flawed. You have 6 records: id date_changed color_start color_end ------------------------------------------------------------------- 1 2020-05-27 16:33:52.000 green yellow 1 2020-06-11 20:12:18.000 yellow red 1 2020-06-11 20:20:58....


1

The new multirange data types in Postgres 14 are exactly what you need. Multirange operators allow to split a date range. The release notes for Postgres 14: Add support for multirange data types (Paul Jungwirth, Alexander Korotkov) These are like range data types, but they allow the specification of multiple, ordered, non-overlapping ranges. An associated ...


0

Chrono::NaiveDate::parse_from_str(s, fmt) mostly solved the first problem. I don't have intervals yet, but I can do dates. I do have to specify the format of the date, e.g. "%Y-%m-%d" but it seems the only option to do so. And to get an integer, I am using the timestamp() function. That gives me a signed integer, which I can then convert to ...


Top 50 recent answers are included