Re: How to create unique constraint on NULL columns

Поиск
Список
Период
Сортировка
От ptjm@interlog.com (Patrick TJ McPhee)
Тема Re: How to create unique constraint on NULL columns
Дата
Msg-id 3jtafuF4p8u1U1@uni-berlin.de
обсуждение исходный текст
Ответ на How to create unique constraint on NULL columns  ("Andrus" <eetasoft@online.ee>)
Список pgsql-general
In article <db8s6o$f36$1@news.hub.org>, Andrus <eetasoft@online.ee> wrote:
% > Then redesign this as a many to many relation.  That way someone can
% > have access to one, two, three, four, or all departments.
%
% This means adding separate row for each department into permission table.
% If new department is added, I must determine in some way users which are
% allowed access to all
% departments and add nw rows to permission table automatically.
%
% It seems more reasonable to use NULL department value as "do'nt know, all
% departments allowed"

But wouldn't you want to have an entry in the department table with
NULL for the department ID? I mean, why should NULL act like NULL wrt
foreign keys, but not wrt unique constraints?


--

Patrick TJ McPhee
North York  Canada
ptjm@interlog.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Janning Vygen
Дата:
Сообщение: Re: PLPGSQL how to get transaction isolation level info
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: foreign key constraints and inheritence