table constraint on two columns

Поиск
Список
Период
Сортировка
От ldrlj1
Тема table constraint on two columns
Дата
Msg-id 1374501921767-5764645.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: table constraint on two columns  (Vik Fearing <vik.fearing@dalibo.com>)
Список pgsql-sql
Postgres 9.2.4.

I have two columns, approved and comments. Approved is a boolean with no
default value and comments is a character varying (255) and nullable.

I am trying to create a constraint that will not allow a row to be entered
if approved is set to false and comments is null.

This does not work. yada, yada, yada... add constraint "chk_comments' check
(approved = false and comments is not null). The constraint is successfully
added, but does not work as I expected.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/table-constraint-on-two-columns-tp5764645.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



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

Предыдущее
От: Mag Gam
Дата:
Сообщение: Mag Gam
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: table constraint on two columns