ERROR: duplicate key violates unique constraint

Поиск
Список
Период
Сортировка
От remco lengers
Тема ERROR: duplicate key violates unique constraint
Дата
Msg-id 32207abd0703200211l46acdab7p5a2d68d69ffc5b6c@mail.gmail.com
обсуждение исходный текст
Ответы unsubscribe
Re: ERROR: duplicate key violates unique constraint
Re: ERROR: duplicate key violates unique constraint
Список pgsql-sql
Hi List,<br /><br />Its been a while since I worked with databases and I am running into the following which I have not
beenable to find the root cause for:<br /><br />I have the follow SQL statement:<br /><br />INSERT INTO reference
VALUES(DEFAULT,'123','2',1); <br /><br />Which generates the following error: <br /><br />"ERROR:  duplicate key
violatesunique constraint "reference_pkey""<br /><br />And the table definition looks like:<br /><br />CREATE TABLE
reference(<br /> referencelist_nr serial unique,  <br />reference_text varchar(40) NOT NULL, <br />reference_type
integerNOT NULL, <br />Topic_Id integer NOT NULL,<br />PRIMARY KEY (referencelist_nr),<br />FOREIGN KEY (Topic_Id)
REFERENCESTopic (Topic_Id),<br />FOREIGN KEY (reference_type) REFERENCES reference_type (reference_type_nr) <br />);<br
/><br/>It seems to me for some reason "DEFAULT" doesn't select the next SERIAL.<br />If I run: <br /><br />INSERT INTO
referenceVALUES (14,'123','2',1);<br /><br />14 being the next free integer it works fine.....<br /><br />I have been
addingdata with "COPY" into this table....does that break something?<br /><br />Your help/tips/insights are
appreciated.<br/><br />Solaris 10/Postgresql 8.1.4<br /><br />Regards,<br /><span><br />..Remco</span> 

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: How to declare cursor if tablename is a variable?
Следующее
От: "Stefan Ionita"
Дата:
Сообщение: unsubscribe