OVERLAPS constraint using TIME columns

Поиск
Список
Период
Сортировка
От Gio -
Тема OVERLAPS constraint using TIME columns
Дата
Msg-id VI1PR05MB158277FA71F6EAD5071154D2FDCE0@VI1PR05MB1582.eurprd05.prod.outlook.com
обсуждение исходный текст
Ответы Re: OVERLAPS constraint using TIME columns
Список pgsql-novice
Hi all,

I have a table for weekly time slots with columns day, from, to.

I would like to add a constraint so that overlapping time slots cannot be added to the db.

The OVERLAPS operator works as I need to, eg
SELECT (TIME ‘5:00', TIME '10:00') OVERLAPS (TIME '22:59', TIME '23:10');

But I can’t use it inside a constraint (ERROR: syntax error near “,”)

ALTER TABLE slots
  ADD CONSTRAINT same_day_slots_overlap
EXCLUDE USING GIST
(
  day WITH =,
  (from, to) WITH OVERLAPS
);

Same error happens if I use the && operator.

I only need time information in my columns so I can either model them as TIME or INTEGER (as minutes from the start of
theday). How can I add
 
such a constraint with these columns? 

Thank you very much,
George



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

Предыдущее
От: Keith
Дата:
Сообщение: Re: First time installing
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: OVERLAPS constraint using TIME columns