Re: Bug? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Bug?
Date
Msg-id 20011115075338.Y7419-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Bug?  (Rasmus Resen Amossen <NOSPAM@hey.com>)
List pgsql-general
On Thu, 15 Nov 2001, Rasmus Resen Amossen wrote:

> I am using postgresql-7.0.3 and is now having a strange problem!!!
> I got a table with a "serial" attribute. For example
> CREATE TABLE test (
>   id SERIAL NOT NULL,
>   val INT
> );
>
> The the following insertions creates an error:
> INSERT INTO test(id,val) VALUES (1,1);
> INSERT INTO test(val) VALUES (1);
>
> Error:
> Cannot insert a duplicate key into unique index test_id_key
>
> After that I can just re�eat the second line and insert without errors.
> Is this bug fixed in newer versions?

You shouldn't insert values into the serial column :).  Or at least if you
are going to do manual inserts you need to update the sequence as well.




pgsql-general by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Postgres+Delphi
Next
From: Doug McNaught
Date:
Subject: Re: Bug?