ERROR: duplicate key violates unique constraint "admin_field_list_pkey"
CSG=#
/I don't understand what is going on. It seems that it can't increment
the primary key properly, or for some reason it's trying to assign an
incorrect value to the key column. If i change the command to include a
value for the key column (in this case the number 9), it seems to work.
I've tried dumping/restoring the DB and also tried it on v8.1 and v8.2
with no success. Any ideas?/
Kind Regards,
Greg Peters.
The problem is in the primary key constraint, not the unique one. I
guess you have inserted the previous rows with 'key' value specified
directly just like in:
=# insert into admin_field_list (key, field, added_by) values (1,
'Talinga', 'Greg Peters');
Thus the sequence is not set to the correct value and generates values
from 1 ... and these are already in the table. Try this
=# SELECT setval('admin_field_list_key_seq', (SELECT MAX(key) FROM
admin_field_list));
and then the insert again.
Tomas