From: | Arup Rakshit <ar(at)zeit(dot)io> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | duplicate key value violates unique constraint "chinese_price_infos_pkey" |
Date: | 2019-05-06 11:05:00 |
Message-ID: | CA963C09-8477-44AA-90F4-14DB94E73B2F@zeit.io |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Every time I try to insert I get the error:
docking_dev=# INSERT INTO "chinese_price_infos" ("item_code", "price_cents", "unit", "description", "company_id", "created_at", "updated_at") VALUES ('01GS10001', 6000, 'Lift', 'Shore Crane Rental', '9ae3f8b8-8f3f-491c-918a-efd8f5100a5e', '2019-05-06 10:49:03.894725', '2019-05-06 10:49:03.894725');
ERROR: duplicate key value violates unique constraint "chinese_price_infos_pkey"
DETAIL: Key (id)=(71165) already exists.
docking_dev=# INSERT INTO "chinese_price_infos" ("item_code", "price_cents", "unit", "description", "company_id", "created_at", "updated_at") VALUES ('01GS10001', 6000, 'Lift', 'Shore Crane Rental', '9ae3f8b8-8f3f-491c-918a-efd8f5100a5e', '2019-05-06 10:49:03.894725', '2019-05-06 10:49:03.894725');
ERROR: duplicate key value violates unique constraint "chinese_price_infos_pkey"
DETAIL: Key (id)=(71166) already exists.
Then I found:
docking_dev=# SELECT MAX(id) FROM chinese_price_infos;
max
--------
128520
(1 row)
docking_dev=# 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.
Thanks,
Arup Rakshit
ar(at)zeit(dot)io
From | Date | Subject | |
---|---|---|---|
Next Message | Ray O'Donnell | 2019-05-06 11:08:03 | Re: duplicate key value violates unique constraint "chinese_price_infos_pkey" |
Previous Message | Andreas Kretschmer | 2019-05-06 10:35:37 | Re: Import Database |