Re: How to create unique constraint on NULL columns - Mailing list pgsql-general

From ptjm@interlog.com (Patrick TJ McPhee)
Subject Re: How to create unique constraint on NULL columns
Date
Msg-id 3jtafuF4p8u1U1@uni-berlin.de
Whole thread Raw
In response to How to create unique constraint on NULL columns  ("Andrus" <eetasoft@online.ee>)
List 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 by date:

Previous
From: Janning Vygen
Date:
Subject: Re: PLPGSQL how to get transaction isolation level info
Next
From: Michael Fuhr
Date:
Subject: Re: foreign key constraints and inheritence