Re: how could a foreign key ever be NULL?

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: how could a foreign key ever be NULL?
Дата
Msg-id 1008609847.2808.2.camel@linda
обсуждение исходный текст
Ответ на how could a foreign key ever be NULL?  (Terrence Brannon <metaperl@mac.com>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Numbering Rows (SEQUENCE, OID) questions
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: how could a foreign key ever be NULL?