mySQL auto increment problem: Duplicate entry '4294967295' for key 1

后端 未结 7 863
-上瘾入骨i
-上瘾入骨i 2021-01-25 02:30

I have a table of emails.

The last record in there for an auto increment id is 3780, which is a legit record. Any new record I now insert is being inserted right there.

7条回答
  •  [愿得一人]
    2021-01-25 03:16

    Its still not totally clear to me what happened here, but I thought I'd follow up.

    In my persistence engine, I had one type of object with a auto-increment id, and a subclass with a GUID id.

    Obviously the two were incompatible. I have a reason to convert the object to its parent and then save it (basically the subclass is an email TEMPLATE that has additional functionality, but when i want to actually SEND the email, I convert it to the parent object and save it to the regular outgoing mail queue). Stupidly, I didn't realize the id formats were different. This resulted in trying to insert a record with a 36 character long string into an int. The string resolved to '0' in the prepared statement and for whatever reason this cause the auto-increment system to WIG OUT and max out the INT auto increment id field on the original table.

    Long story short, good thing I was keeping logs.

    Josh

提交回复
热议问题