I'm wondering if there is anyway to enforce that ranges in a table be adjacent in perhaps a similar way to enforcing that they are non-overlapping.
Consider a (very simplified table) CREATE TABLE ( thing_id int, period tsrange, EXCLUDE USING gist (thing_id WITH =, period WITH &&), CHECK (lower_inc(period) and not upper_inc(period)) ); This should (I believe) enforce that all periods for a given thing are non-overlapping, and that each is lower-inclusive, upper-exclusive ranges. I'd also like to enforce that all ranges for a given 'thing' are adjacent. Is that possible? Thanks, Ben