Re: how could a foreign key ever be NULL? - Mailing list pgsql-sql

From Oliver Elphick
Subject Re: how could a foreign key ever be NULL?
Date
Msg-id 1008609847.2808.2.camel@linda
Whole thread Raw
In response to how could a foreign key ever be NULL?  (Terrence Brannon <metaperl@mac.com>)
List pgsql-sql
On Mon, 2001-12-17 at 11:38, Terrence Brannon wrote:
> The Momjian book states:
>
> A single-column foreign key is either NULL or matches a primary key
>
> But the problem I have with this statement is that a primary key
> cannot be null or duplicate. And since the foreign key references
> a value that is neither null or duplicate, how could it ever be
> 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.

--
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      man that is among you: Do not think of yourself more
highly than you ought, but rather think of yourself      with sober judgement, in accordance with the measure      of
faithGod has given you."            Romans 12:3  

pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Numbering Rows (SEQUENCE, OID) questions
Next
From: Stephan Szabo
Date:
Subject: Re: how could a foreign key ever be NULL?