table check constraint

Поиск
Список
Период
Сортировка
От Robert Schnabel
Тема table check constraint
Дата
Msg-id 4A1D8E85.9040909@missouri.edu
обсуждение исходный текст
Список pgsql-novice
I'm trying to add range check constraints to tables but I'm not 100%
sure I'm doing it correctly for one of them.  Specifically, what do you
do if you want to allow two non-overlapping ranges?  For example, I
need to have everything (>105 AND <199) OR (>202 AND
<900).  I read in the docs that using 'between' isn't a good idea so
I did something like the following:

ALTER TABLE gen000
  ADD CONSTRAINT check000 CHECK (sample_id > 105 AND sample_id <
199 OR sample_id > 202 AND sample_id < 900);

Will this behave the way it reads or do I need to structure it
differently?

Thanks,
Bob

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

Предыдущее
От: Zach Calvert
Дата:
Сообщение: Re: Query Optimization
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Query Optimization