Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 42A389FBB81 for ; Wed, 24 Oct 2007 04:43:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 82534-02 for ; Wed, 24 Oct 2007 04:43:25 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id B4F359FBAF7 for ; Wed, 24 Oct 2007 04:43:33 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ikatj-0007Uw-Ph for pgsql-sql@postgresql.org; Wed, 24 Oct 2007 07:43:27 +0000 Received: from cpe.atm2-0-1261189.0x503fa7b2.bynxx8.customer.tele.dk ([80.63.167.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Oct 2007 07:43:27 +0000 Received: from nis by cpe.atm2-0-1261189.0x503fa7b2.bynxx8.customer.tele.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Oct 2007 07:43:27 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: =?ISO-8859-1?Q?Nis_J=F8rgensen?= Subject: Re: Quick question re foreign keys. Date: Wed, 24 Oct 2007 09:43:10 +0200 Lines: 18 Message-ID: <471EF78E.8050503@superlativ.dk> References: <471EA7D5.9040403@autoledgers.com.au> <21715.1193193880@sss.pgh.pa.us> <471EB55F.5050600@autoledgers.com.au> <20071024012705.5f253946.darcy@druid.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org Cc: Paul Lambert , Tom Lane , pgsql-sql X-Gmane-NNTP-Posting-Host: cpe.atm2-0-1261189.0x503fa7b2.bynxx8.customer.tele.dk User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) In-Reply-To: <20071024012705.5f253946.darcy@druid.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/102 X-Sequence-Number: 29474 D'Arcy J.M. Cain skrev: > On Wed, 24 Oct 2007 11:00:47 +0800 > Paul Lambert wrote: >> It's marked not null as a result of being part of the primary key for >> that table which I can't really get around. >> >> I can get away with not having the foreign key though, so I'll have to >> go down that path. > > It can't be the primary key and have NULLs. It sounds to me like you > have a design problem somewhere. Well, I have a couple of times had the "need" to have a primary key/uniqueness constraint with one column nullable (indicating "Not Applicable"). The "problem" is that we have only one NULL, which for comparison purposes is interpreted as "Not Known". Nis