Product : MySql
Version : 3.23.45
Error : Invalid duplicate key error for large
numeric primary key's
Description
-------------------------------------------
When a large numeric primary key is created
ID NUMERIC(38)
PRIMARY KEY (ID)
And you insert two records with different Id's
ID1= 170000000000000000001
ID2= 170000000000000000002
You get an error 1062 : Duplicate Key
Diagnosis
-------------------------------------------
I noticed that this problem only happens when you
insert keys greater than 19 chars which is around the
maximum size of a long. I thought it might be
possible that the key comparison was being done using
a field that was not large enough to handle the data
for that column.