| От | Dawid Kuroczko |
|---|---|
| Тема | Re: constraint -- one or the other column not null |
| Дата | |
| Msg-id | 758d5e7f0609060029x46dc5889g4342d43f84e554ee@mail.gmail.com обсуждение исходный текст |
| Ответ на | constraint -- one or the other column not null ("George Pavlov" <gpavlov@mynewplace.com>) |
| Ответы |
Re: constraint -- one or the other column not null
|
| Список | pgsql-general |
On 9/6/06, George Pavlov <gpavlov@mynewplace.com> wrote: > I have two columns, both individually nullable, but a row needs to have > a value in one or the other. What is the best way to implement the > constraints? I currently have: > > create table f ( > a int, > b int, > check (a + b is null), > check (coalesce(a,b) is not null) > ); > > Is there a better way to do it? Personally I woud simply put there CHECK(a IS NOT NULL OR b IS NOT NULL) which is probably the simplest form of your constraint. :)
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера