ERROR: duplicate key violates unique constraint - Mailing list pgsql-sql

From remco lengers
Subject ERROR: duplicate key violates unique constraint
Date
Msg-id 32207abd0703200211l46acdab7p5a2d68d69ffc5b6c@mail.gmail.com
Whole thread Raw
Responses unsubscribe  ("Stefan Ionita" <ionitastefan@hotmail.com>)
Re: ERROR: duplicate key violates unique constraint  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Re: ERROR: duplicate key violates unique constraint  (Richard Huxton <dev@archonet.com>)
List 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 by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: How to declare cursor if tablename is a variable?
Next
From: "Stefan Ionita"
Date:
Subject: unsubscribe