Need help with constraint to prevent overlaps

Поиск
Список
Период
Сортировка
От Matthew Wilson
Тема Need help with constraint to prevent overlaps
Дата
Msg-id slrng7en5p.6rt.matt@sprout.tplus1.com
обсуждение исходный текст
Ответы Re: Need help with constraint to prevent overlaps  ("Adam Rich" <adam.r@sbcglobal.net>)
Список pgsql-general
I'm building a shift-scheduling app.  I want to make a constraint in my
database that prevents one human from being assigned to work two
different jobs at the same time.

In other words, if I schedule John Doe to mop bathrooms from 10 AM until
4 PM, some other manager will not be able to schedule John Doe for a 1
PM meeting.

How can I do this with constraints?  Would I need to write a trigger
that does some 'select ... between ...' work?

I know I could do this in the python application code I am using on top
of postgres, but I really like putting as many constraints as possible
in my data model.

TIA

Matt

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: lc_ctype and lower()
Следующее
От: Augustin Amann
Дата:
Сообщение: Update / Lock (and ShareLock) question