Re: Problem with unique key
От | Richard Huxton |
---|---|
Тема | Re: Problem with unique key |
Дата | |
Msg-id | 456C02A8.5020503@archonet.com обсуждение исходный текст |
Ответ на | Problem with unique key ("Greg Peters" <gregpeters79@gmail.com>) |
Ответы |
Re: Problem with unique key
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: