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.