| От | Tom Lane |
|---|---|
| Тема | Re: Cannot insert dup id in pk |
| Дата | |
| Msg-id | 22800.1058282759@sss.pgh.pa.us обсуждение |
| Ответ на | Cannot insert dup id in pk (Scott Cain <cain@cshl.org>) |
| Список | pgsql-sql |
Scott Cain <cain@cshl.org> writes:
> Note that I do not try to insert anything into fid, the primary key on
> this table. Why does Postgres think I am?
But you *are* trying to insert something into fid, namely the default
value:default nextval('public.fdata _fid_seq'::text)
My guess is that you have been inconsistent about whether you used the
sequence or explicit assignment to fid, and now you have some rows in
the table that have fid values higher than the current sequence value.
I'd suggest adjusting the sequence, along the lines of
SELECT setval('public.fdata _fid_seq', max(fid)+1) FROM fdata;
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера