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 16:01:38 +0100
Message-ID: <41597CD2.1030602@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>

Hello again,


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)

I noticed a table constraint can be added via ALTER TABLE. Is it correct 
that a column constraint cannot be added via the ALTER TABLE other than 
by dropping and adding the column? (I am using psql 7.4.2.)

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



view thread (6+ messages)  latest in thread

Message-ID: <41597CD2.1030602@numerixtechnology.de>
Permalink:  ../41597CD2.1030602@numerixtechnology.de/
Also on:    postgresql.org/message-id/41597CD2.1030602@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: <41597CD2.1030602@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