Multiple primary keys - Mailing list pgsql-docs

From Mike Cianflone
Subject Multiple primary keys
Date
Msg-id B9F49C7F90DF6C4B82991BFA8E9D547B17D0FF@BUFORD.littlefeet-inc.com
Whole thread Raw
Responses RE: Multiple primary keys  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-docs
    Does Postgres support multiple primary keys in any way? It doesn't
seem to directly support it in that if I try to specify two primary keys it
fails on the second one.
    What I'm trying to do is constrain the input based upon two columns,
rather than just one column. For example, the user can input (0,0), and then
(0,1), and then (0,2), and that would be fine. Then later the user could
input (1,0), and then (1,1) and then (1,2), and that would be fine also.
Since my constraint (or set of primary keys) would be based upon the two
columns, not just the first, it's ok to duplicate the first value as long as
both the first and second value are unique as a pair.

    Does anyone know how to make a pair constraint?

Thanks for any pointers.

Mike Cianflone

pgsql-docs by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL Feature Sheet
Next
From: Mike Cianflone
Date:
Subject: RE: Multiple primary keys