Re: how could a foreign key ever be NULL?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Terrence Brannon <metaperl(at)mac(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how could a foreign key ever be NULL?
Date: 2001-12-17 17:06:10
Message-ID: 200112171706.fBHH6Bh06057@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Elphick 2001-12-17 17:24:07 Re: how could a foreign key ever be NULL?
Previous Message Bruce Momjian 2001-12-17 17:04:07 Re: Numbering Rows (SEQUENCE, OID) questions