Search Postgresql Archives

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, May 6, 2019 at 6:05 AM Arup Rakshit <ar@xxxxxxx> wrote:

SELECT MAX(id) FROM chinese_price_infos;  max   --------  128520(1 row)
SELECT nextval('chinese_price_infos_id_seq');  nextval ---------   71164(1 row)
Not sure how it is out of sync. How can I fix this permanently. I ran vacuum analyze verbose; still same error

Vacuuming the table doesn't change the fact that your sequence isn't generating unique keys.  Without knowing the full history of the table, I can only speculate as to how keys got inserted that are beyond the sequence's current vlue, but most likely you will need to use the sequence manipulation function setval to set the sequence to at least one greater than the current maximum value. 
--
Mike Nolan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux