Failed to store position - duplicate entry

Mark a year ago

Traccar stopped saving new positions in the tc_positions table. I have the following message in the logs: Failed to store position - duplicate entry '2147483647' for key 'tc_position.PRIMARY'. I am deleting a record with id 2147483647. In its place, 1 new record is saved and the story repeats itself. Does anyone have an idea?

Anton Tananaev a year ago

You reached the id limit on the positions table. You can update the column size to fix this. I believe this has been discussed on the forum before somewhere.

Mark a year ago

Thanks, I found something. I changed the id type from INT to BIGINT. It will take some time.

Mark a year ago

For others: I did the same in the tc_events table (positionid) and in the tc_devices table (positionid). Everything works now.

carlock a year ago

excuse the intrusion. a doubt in this case. assuming I have this issue. and I don't mind old positions since I only kept them for 3 months or less. What would happen if I just changed the index to 1 again? Wouldn't it start using cells from there? Would It keep the data searchable? Also in the devices or similar tables?

Anton Tananaev a year ago

If you want to start from 1, you have to update the auto-increment value. But I believe you might need to clear all the data to do that.

Swanhtet a year ago

HI

I have a similar issue now. Do I only need to change the column type? is there anything i need to aware ? just asking before i change the type.

ALTER TABLE tc_positions MODIFY COLUMN id BIGINT;

just this alone will be ok?

Mark a year ago

You need to do this in three tables. Additionally in the tc_events table (positionid) and in the tc_devices table (positionid). Then it's enough.

imarinkovic 10 months ago

Swanhtet
Just to add my 2 cents, this is my alter, to avoid autoincrement problems after reconstructing tc_positions

ALTER TABLE tc_positions MODIFY COLUMN id BIGINT AUTO_INCREMENT;