From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Susan Lane <suel(at)dpn(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Primary keys and NOT NULL |
Date: | 2002-07-12 00:03:57 |
Message-ID: | 20020711170203.R816-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 11 Jul 2002, Susan Lane wrote:
> Hi -
>
> I noticed that all of my primary keys are specified as not null and I did
> not specify not null when I built the tables. Does Postgres automatically
> make all primary keys not null? This is a problem for me because I have a
> few tables that have multiple column primary keys where one of the columns
> may be null. Is there any way for me to change the not null specification?
> or is that a requirement for primary keys in Postgres? This was not the
> case in Oracle....which is where I'm trying to port my data from.
At least SQL92, primary keys are not satisifed if any of the values are
null, by my reading:
"A unique constraint is satisfied if and only if no two rows in
a table have the same non-null values in the unique columns. In
addition, if the unique constraint was defined with PRIMARY KEY,
then it requires that none of the values in the specified column or
columns be the null value."
Do you really need this as a primary key as opposed to a unique
constraint?
From | Date | Subject | |
---|---|---|---|
Next Message | Curt Sampson | 2002-07-12 00:24:34 | Re: Linux max on shared buffers? |
Previous Message | Susan Lane | 2002-07-11 23:50:19 | Primary keys and NOT NULL |