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 8097832A030 for ; Tue, 28 Sep 2004 16:22:57 +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 80213-07 for ; Tue, 28 Sep 2004 15:22:56 +0000 (GMT) Received: from msgdirector3.onetel.net.uk (msgdirector3.onetel.net.uk [212.67.96.159]) by svr1.postgresql.org (Postfix) with ESMTP id 9FBCD32A041 for ; Tue, 28 Sep 2004 16:22:54 +0100 (BST) Received: from bolek.coachhouse (213-78-127-230.friaco.onetel.net.uk [213.78.127.230] (may be forged)) by msgdirector3.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id CTD73400; Tue, 28 Sep 2004 16:22:50 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1CCJTy-0002IH-00 ; Tue, 28 Sep 2004 16:01:34 +0100 Message-ID: <41597CD2.1030602@numerixtechnology.de> Date: Tue, 28 Sep 2004 16:01:38 +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.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/249 X-Sequence-Number: 19095 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