Re: CHECK col A not NULL if col B='x'

From: T E Schmitz <mailreg(at)numerixtechnology(dot)de>
To:
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: CHECK col A not NULL if col B='x'
Date: 2004-09-28 14:38:21
Message-ID: 4159775D.2050206@numerixtechnology.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message T E Schmitz 2004-09-28 15:01:38 Re: CHECK col A not NULL if col B='x'
Previous Message Tom Lane 2004-09-28 14:24:16 Re: Best way to know if there is a row