Enforcing adjacent ranges

Поиск
Список
Период
Сортировка
От Ben Leslie
Тема Enforcing adjacent ranges
Дата
Msg-id CABZ0LtDKVXS6+9LJWmK-ywcYBJ7tcBKoZVGB79S0Zp5XAntv2g@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: clean out ./data/base/pgsql_tmp
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Infinite replication loop with pglogical