RE: Multiple primary keys

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема RE: Multiple primary keys
Дата
Msg-id ECEHIKNFIMMECLEBJFIGEEHBCAAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Multiple primary keys  (Mike Cianflone <mcianflone@littlefeet-inc.com>)
Список pgsql-docs
Like this:

CREATE TABLE example (
    xvalue int4,
    yvalue int4,
    PRIMARY KEY (xvalue, yvalue)
);

Chris

-----Original Message-----
From: pgsql-docs-owner@postgresql.org
[mailto:pgsql-docs-owner@postgresql.org]On Behalf Of Mike Cianflone
Sent: Wednesday, 2 May 2001 5:39 AM
To: pgsql-docs@postgresql.org
Subject: [DOCS] Multiple primary keys


    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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl


В списке pgsql-docs по дате отправления:

Предыдущее
От: Mike Cianflone
Дата:
Сообщение: RE: Multiple primary keys
Следующее
От: Mike Cianflone
Дата:
Сообщение: Adding support for plpgsql