Greg Peters wrote:
> CSG=# \d admin_field_list
> Table "public.admin_field_list"
> Column | Type |
> Modifiers
> -------------+-----------------------------+----------------------------------------------------------------
>
> key | bigint | not null default
> nextval('admin_field_list_key_seq'::regclass)
> *Now, as you can see, there is no field called "Kogan North", but when I
> enter the command:*
> CSG=# insert into admin_field_list (field, added_by) values ('Kogan North',
> 'Greg Peters');
> ERROR: duplicate key violates unique constraint "admin_field_list_pkey"
It's not complaining about "field" but about "key" - look at the
constraint name. I'm guessing you've added rows with manual values for
the "key" column. The sequence doesn't know about these, so is
generating values already in use.
You can use setval(<sequence-name>) to update the sequence's value.
--
Richard Huxton
Archonet Ltd