Re: multi-column primary key insert error ('duplicate' complaint)

Поиск
Список
Период
Сортировка
От Christian Ullrich
Тема Re: multi-column primary key insert error ('duplicate' complaint)
Дата
Msg-id 20020805115702.GA2477@christian.chrullrich.de
обсуждение исходный текст
Ответ на multi-column primary key insert error ('duplicate' complaint)  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
* Jean-Christian Imbeault wrote on Monday, 2002-08-05:

> create table MOVIES (
>
> id                      char(12)        unique references PRODUCTS,
                                          ^^^^^^

> volume_id               int2            not null default 1,
> label_id                integer         references LABELS(id),
> length                  int2            not null,
>
> primary key(id, volume_id)
> );
>
> ERROR:  Cannot insert a duplicate key into unique index movies_id_key
                                                          |      |
                                                 table name      |
                                                        field name
>
> I thought I had defined the primary key to span two columns ... the data
> in the first two columns is not a duplicate...

There is a unique index on "id" alone, in addition to the
participation in the primary key.

--
Christian Ullrich                   Registrierter Linux-User #125183

"Deliver."

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

Предыдущее
От: Darren Ferguson
Дата:
Сообщение: Re: multi-column primary key insert error ('duplicate'
Следующее
От: Christian Ullrich
Дата:
Сообщение: Re: Foreign keys: referencing a REFERENCES doesn7t work?