CHECK clause doesn't work with CASE clause

From: "Jrg Holetschek" <mail2holly(at)gmx(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: CHECK clause doesn't work with CASE clause
Date: 2002-06-27 09:52:54
Message-ID: afenai$2291$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message q u a d r a 2002-06-27 11:50:09 graphical interface - admin
Previous Message Christopher Kings-Lynne 2002-06-27 03:51:25 Re: Possibility of Index-Only access in PostgreSQL?