CHECK clause doesn't work with CASE clause

Поиск
Список
Период
Сортировка
Искать
От
Jörg Holetschek
Тема
CHECK clause doesn't work with CASE clause
Дата
Msg-id
afenai$2291$1@news.hub.org
Список
Дерево обсуждения
CHECK clause doesn't work with CASE clause "Jörg Holetschek" <mail2holly@gmx.de>
Re: CHECK clause doesn't work with CASE clause Richard Poole <rp@guests.deus.net>
Re: CHECK clause doesn't work with CASE clause Richard Huxton <dev@archonet.com>
Re: CHECK clause doesn't work with CASE clause Tom Lane <tgl@sss.pgh.pa.us>
Hi folks,

I have a problem with a CHECK clause that doesn't seem to work properly. The
CREATE TABLE statement looks like this:

CREATE TABLE epilepsy_information (   [...]      epilepsy_class       Char             CHECK (epilepsy_class IN ('f', 'g', 'n')),      focus                Integer                     REFERENCES focus(id)             CHECK (                 CASE                    WHEN ((focus <> NULL) AND (epilepsy_class = 'f')) THEN
TRUE                    WHEN ((focus <> NULL) AND (epilepsy_class IN ('g',
'n'))) THEN FALSE                 END),   [...]
);

It shouldn't be possible to insert a value into focus when epilepsy_class
has one of the values 'g' or 'n'. But it is. Can anyone help?


Thanx sincerefully,
Joerg





В списке pgsql-sql по дате отправления
От: Dennis Kaarsemaker
Дата:
Сообщение: Calculating with sql
От: Tom Lane
Дата:
FAQ