X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F363B329F21 for ; Tue, 28 Sep 2004 15:38:32 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62563-01 for ; Tue, 28 Sep 2004 14:38:27 +0000 (GMT) Received: from msgdirector2.onetel.net.uk (msgdirector2.onetel.net.uk [212.67.96.149]) by svr1.postgresql.org (Postfix) with ESMTP id C6199329EFB for ; Tue, 28 Sep 2004 15:38:29 +0100 (BST) Received: from bolek.coachhouse (213-78-97-140.friaco.onetel.net.uk [213.78.97.140]) by msgdirector2.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id BXK35648; Tue, 28 Sep 2004 15:38:27 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1CCJ7S-0002Ha-00 ; Tue, 28 Sep 2004 15:38:18 +0100 Message-ID: <4159775D.2050206@numerixtechnology.de> Date: Tue, 28 Sep 2004 15:38:21 +0100 From: T E Schmitz Reply-To: mailreg@numerixtechnology.de User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-sql Subject: Re: CHECK col A not NULL if col B='x' References: <41596EDA.4030909@numerixtechnology.de> <200409281112.02986.martin@bugs.unl.edu.ar> In-Reply-To: <200409281112.02986.martin@bugs.unl.edu.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200409/248 X-Sequence-Number: 19094 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