Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBHHO9m77196 for ; Mon, 17 Dec 2001 12:24:09 -0500 (EST) (envelope-from olly@lfix.co.uk) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 2.12 #1) id 16G1Uq-0004y1-0V; Mon, 17 Dec 2001 17:24:13 +0000 Received: from localhost (olly@localhost [127.0.0.1]) by linda.lfix.co.uk (8.12.1/8.12.1/Debian -2) with ESMTP id fBHHO7O6003403; Mon, 17 Dec 2001 17:24:07 GMT Subject: Re: how could a foreign key ever be NULL? From: Oliver Elphick To: Terrence Brannon Cc: pgsql-sql@postgresql.org In-Reply-To: <8BBB36A0-F2E2-11D5-92F7-003065C2A10C@mac.com> References: <8BBB36A0-F2E2-11D5-92F7-003065C2A10C@mac.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-bhir7ZrBBBH45c/Ew6Q6" X-Mailer: Evolution/0.99.2 (Preview Release) Date: 17 Dec 2001 17:24:07 +0000 Message-Id: <1008609847.2808.2.camel@linda> Mime-Version: 1.0 X-Archive-Number: 200112/184 X-Sequence-Number: 6007 --=-bhir7ZrBBBH45c/Ew6Q6 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2001-12-17 at 11:38, Terrence Brannon wrote: > The Momjian book states: >=20 > A single-column foreign key is either NULL or matches a primary key >=20 > But the problem I have with this statement is that a primary key=20 > cannot be null or duplicate. And since the foreign key references=20 > a value that is neither null or duplicate, how could it ever be=20 > NULL? If the foreign key is NULL, it doesn't reference anything. If this is not a valid condition, the column should be declared as NOT NULL. --=20 Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "For I say, through the grace given unto me, to every=20 man that is among you: Do not think of yourself more=20 highly than you ought, but rather think of yourself=20 with sober judgement, in accordance with the measure=20 of faith God has given you." Romans 12:3=20 --=-bhir7ZrBBBH45c/Ew6Q6 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA8Hio3YU1MND4dDBwRAuSJAJ0a63Le8rm/uelXH/ksQ7CHZ05q+wCfcigR Z1FJsIeHtLb5FGf8TQhF/hk= =NIdl -----END PGP SIGNATURE----- --=-bhir7ZrBBBH45c/Ew6Q6--