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

From Bruce Momjian
Subject Re: how could a foreign key ever be NULL?
Date
Msg-id 200112171706.fBHH6Bh06057@candle.pha.pa.us
Whole thread Raw
In response to how could a foreign key ever be NULL?  (Terrence Brannon <metaperl@mac.com>)
List pgsql-sql
> 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?

Uh, you could have a foreign key row that doesn't match a primary key
row, and is hence NULL, can't you?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-sql by date:

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