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

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема multi-column primary key insert error ('duplicate' complaint)
Дата
Msg-id 3D4E49E0.3010605@mega-bucks.co.jp
обсуждение исходный текст
Ответы Re: multi-column primary key insert error ('duplicate'  (Darren Ferguson <darren@crystalballinc.com>)
Re: multi-column primary key insert error ('duplicate' complaint)  (Christian Ullrich <chris@chrullrich.de>)
Список pgsql-general
I have the following table where I want to use two columns as the primary:

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)
);


However when I try the following:

insert into movies values('589000901097','1','1','1');
insert into movies values('589000901097','2','1','1');

I get this error:

ERROR:  Cannot insert a duplicate key into unique index movies_id_key

I thought I had defined the primary key to span two columns ... the data
in the first two columns is not a duplicate...

What did I miss?

Thanks!

Jc


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Reviewed: max. no of relations in a database
Следующее
От: marko.asplund@kronodoc.fi
Дата:
Сообщение: concept question: PostgreSQL vs. Oracle database