| От | Michael Fuhr |
|---|---|
| Тема | Re: Constraint that compares and limits field values |
| Дата | |
| Msg-id | 20060125172812.GA76156@winnie.fuhr.org обсуждение исходный текст |
| Ответ на | Re: Constraint that compares and limits field values (MargaretGillon@chromalloy.com) |
| Ответы |
Re: Constraint that compares and limits field values
|
| Список | pgsql-general |
On Wed, Jan 25, 2006 at 08:39:00AM -0800, MargaretGillon@chromalloy.com wrote: > I have taken your suggestion and changed the values to NULL for the empty > foreign keys. Thank you for the constraint. I modified it to check for > NULL and it works great. > > ALTER TABLE event > ADD CONSTRAINT two_nulls_1 CHECK (((((evenid1 IS NULL) AND (evevid1 IS > NULL)) OR ((evevid1 IS NULL) AND (evreid1 IS NULL))) OR ((evenid1 IS NULL) > AND (evreid1 IS NULL)))); Is there a requirement that exactly one column be NOT NULL? If so then you'll need to add a check for that because this constraint would allow all three to be NULL. -- Michael Fuhr
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера