Re: duplicate key value violates unique constraint

2020-03-07 Thread Ron
Asking the same question on multiple lists is strongly frowned upon. On 3/7/20 1:29 PM, Ashkar Dev wrote: Hi all, how to fix a problem, suppose there is a table with id and username if I set the id to bigint so the limit is 9223372036854775807 if I insert for example 3 rows id    username -- 

Re: duplicate key value violates unique constraint

2020-03-07 Thread Adrian Klaver
On 3/7/20 11:29 AM, Ashkar Dev wrote: Hi all, how to fix a problem, suppose there is a table with id and username if I set the id to bigint so the limit is 9223372036854775807 if I insert for example 3 rows id    username --    -- 1     abc 2     def 3     ghi if I delete all rows

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

2019-05-07 Thread Frank Alberto Rodriguez
You can fix the problem with this query: SELECT setval('chinese_price_infos_id_seq', sq.val) from ( SELECT MAX(id) as val FROM chinese_price_infos ) sq; But you have to search in your application because in some point the app are inserting the id column instead of leave this task to the DB. If y

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

2019-05-06 Thread Michael Nolan
On Mon, May 6, 2019 at 6:05 AM Arup Rakshit 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;

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

2019-05-06 Thread Ray O'Donnell
On 06/05/2019 12:10, Arup Rakshit wrote: Hi, Thanks for your reply. It is automatic, my app don’t creates ID, it delegates it to the DB. I am using Ruby on Rails app, where we use Postgresql. Well, I'm only throwing out wild guesses, but another possibility is that rows were loaded manually i

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

2019-05-06 Thread Arup Rakshit
Hi, Thanks for your reply. It is automatic, my app don’t creates ID, it delegates it to the DB. I am using Ruby on Rails app, where we use Postgresql. docking_dev=# \d chinese_price_infos; Table "public.chinese_price_infos" Column|Type

Re: duplicate key value violates unique constraint "chinese_price_infos_pkey"

2019-05-06 Thread Ray O'Donnell
On 06/05/2019 12:05, Arup Rakshit wrote: 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-8f

Re: duplicate key value violates unique constraint "pg_statistic_relid_att_inh_index" while performing full vacuum on the database

2018-05-09 Thread Laurenz Albe
Raghavendra Rao J S V wrote: > While performing vacuum full, I have received the below highlighted error. > Please guide me how to resolve this issue. > > > /opt/postgres/9.2/bin/psql -p 5433 --username=cmuser cpcm -c "VACUUM FULL > ANALYZE;" > > > ERROR: duplicate key value violates uniqu