Re: Multicolumn primary key with null value - Mailing list pgsql-general

From Said Ramirez
Subject Re: Multicolumn primary key with null value
Date
Msg-id 4BD08A78.40807@vonage.com
Whole thread Raw
In response to Multicolumn primary key with null value  (Szymon Guz <mabewlun@gmail.com>)
Responses Re: Multicolumn primary key with null value  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
Primary keys are defined as 'unique not null' even if they are
composite. So I believe postgres would not let you do that:

5.3.4. Primary Keys

Technically, a primary key constraint is simply a combination of a
unique constraint and a not-null constraint.
....

A primary key indicates that a column or group of columns can be used as
a unique identifier for rows in the table. (This is a direct consequence
of the definition of a primary key. Note that a unique constraint does
not, by itself, provide a unique identifier because it does not exclude
null values.) This is useful both for documentation purposes and for
client applications.

http://www.postgresql.org/docs/8.1/static/ddl-constraints.html


Szymon Guz wrote:
> Does any SQL standard allows for a multicolumn primary key where in one record there is a null in on of the primary
keycolumns? 
>
> regards
> Szymon Guz

pgsql-general by date:

Previous
From: Morgan Taschuk
Date:
Subject: PSQL segmentation fault after setting host
Next
From: Tom Lane
Date:
Subject: Re: PSQL segmentation fault after setting host