Re: can this be done with a check expression?

Поиск
Список
Период
Сортировка
От Jonathan S. Katz
Тема Re: can this be done with a check expression?
Дата
Msg-id 88520F99-849D-438C-9CCD-F80700636A2A@excoventures.com
обсуждение исходный текст
Ответ на can this be done with a check expression?  (Wayne Cuddy <lists-pgsql@useunix.net>)
Ответы Re: can this be done with a check expression?  (Wayne Cuddy <lists-pgsql@useunix.net>)
Список pgsql-sql
On Aug 2, 2012, at 7:10 PM, Wayne Cuddy wrote:

I have a table with 3 columns:

name text
start_id integer
end_id integer

start_id and end_id are ranges which must not overlap but can have gaps
between them. Is it possible to formulate a table check constraint that
can verify that either id does not fall within an existing range at
insert time? IE prevent overlaps during insert?

Thanks,
Wayne

So this answer will not help you for the here-and-now, but Postgres 9.2 is going to be released in the near future (though the beta is available) and contains "range types" which have check constraints on them:


You could formulate a check constraint right now to do the equivalent, albeit it will involve a lot of conditions.

Jonathan

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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: can this be done with a check expression?
Следующее
От: Wayne Cuddy
Дата:
Сообщение: Re: can this be done with a check expression?