Re: CHECK col A not NULL if col B='x' - Mailing list pgsql-sql

From T E Schmitz
Subject Re: CHECK col A not NULL if col B='x'
Date
Msg-id 4159775D.2050206@numerixtechnology.de
Whole thread Raw
In response to Re: CHECK col A not NULL if col B='x'  (Martin Marques <martin@bugs.unl.edu.ar>)
List pgsql-sql
Hola Martin!

Martin Marques wrote:

> El Mar 28 Sep 2004 11:02, T E Schmitz escribió:
> 
>>Is it possible to set up a table CHECK, which ensures that column A is
>>NOT NULL if column B = 'x' ?
> 
> CONSTRAINT somename CHECK (B <> 'x' OR A IS NOT NULL)

This is brilliant. Only detected this today. Don't know how I managed to 
overlook the CHECK constraints ;-)

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Best way to know if there is a row
Next
From: T E Schmitz
Date:
Subject: Re: CHECK col A not NULL if col B='x'