pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: T E Schmitz <mailreg@numerixtechnology.de>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: CHECK col A not NULL if col B='x'
Date: Tue, 28 Sep 2004 15:38:21 +0100
Message-ID: <4159775D.2050206@numerixtechnology.de> (raw)
In-Reply-To: <200409281112.02986.martin@bugs.unl.edu.ar>
References: <41596EDA.4030909@numerixtechnology.de>
	<200409281112.02986.martin@bugs.unl.edu.ar>

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



view thread (6+ messages)  latest in thread

Message-ID: <4159775D.2050206@numerixtechnology.de>
Permalink:  ../4159775D.2050206@numerixtechnology.de/
Also on:    postgresql.org/message-id/4159775D.2050206@numerixtechnology.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mailreg@numerixtechnology.de
  Subject: Re: CHECK col A not NULL if col B='x'
  In-Reply-To: <4159775D.2050206@numerixtechnology.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox