Unique or Primary Key?

Поиск
Список
Период
Сортировка
От pgsql@itsbruce.uklinux.net
Тема Unique or Primary Key?
Дата
Msg-id 20010503005803.A12822@knossos.bruce
обсуждение исходный текст
Ответы Re: Unique or Primary Key?  ("Eric G. Miller" <egm2@jps.net>)
Список pgsql-general
This table is man-in-the-middle of a many-to-many relationship:

CREATE TABLE cv_entries (
        subscriber INTEGER NOT NULL
                REFERENCES subscribers
                        ON DELETE CASCADE
                        ON UPDATE CASCADE,
        entry_type INTEGER NOT NULL
            REFERENCES cv_entry_types
                        ON DELETE CASCADE
                        ON UPDATE CASCADE,
        ordinal INTEGER,
    value1 TEXT,
    value2 TEXT,
    minimum_trust SMALLINT,
    UNIQUE(subscriber, entry_type, ordinal)
);

I used a unique index here because I couldn't see any reason for a
Primary Key - this table will always be searched on either the
subscriber or entry_type index.

Was I wrong?  Should this be a Primary Key?

--
Bruce

Bitterly it mathinketh me, that I spent mine wholle lyf in the lists
against the ignorant.
        -- Roger Bacon, "Doctor Mirabilis"

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

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: Tuple Max Size on 7.1
Следующее
От: GH
Дата:
Сообщение: Re: Ideal hardware configuration for pgsql