1 message in com.mysql.lists.mysqlInvalid Duplicate Key 1062 Error
FromSent OnAttachments
Michael Connor14 Mar 2002 10:38 
Subject:Invalid Duplicate Key 1062 Error
From:Michael Connor (mlco@yahoo.com)
Date:03/14/2002 10:38:44 AM
List:com.mysql.lists.mysql

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.