Re: PRIMARY KEY on a *group* of columns imply that each - Mailing list pgsql-general

From Scott Marlowe
Subject Re: PRIMARY KEY on a *group* of columns imply that each
Date
Msg-id 1114548524.13303.1276.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: PRIMARY KEY on a *group* of columns imply that each column is NOT  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Responses Re: PRIMARY KEY on a *group* of columns imply that each column is NOT
List pgsql-general
On Tue, 2005-04-26 at 15:39, Stephane Bortzmeyer wrote:
> On Tue, Apr 26, 2005 at 03:22:40PM -0500,
>  Guy Rouillier <guyr@masergy.com> wrote
>  a message of 37 lines which said:
>
> > "The primary key constraint specifies that a column or columns of a
> > table may contain only unique (non-duplicate), nonnull values.
> > Technically, PRIMARY KEY is merely a combination of UNIQUE and NOT
> > NULL"
> >
> > Primary key columns cannot contain null values.
>
> I read the above also. It is perfectly clear for primary key on one
> column.
>
> But it does not apply to primary keys containing a group of
> columns. In that case (my case), columns do not have to be UNIQUE. But
> they have to be NOT NULL, which puzzles me.

Here's a quote from the SQL1992 spec that's VERY clear:

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.

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: blob storage
Next
From: David Gagnon
Date:
Subject: How to reduce disk usage and found where disk usage is used? + reindex force doesn`t seem to work