Not the answer I hoped to get but, thanks Carsten!
Von: Carsten Pedersen [mailto:carsten@stripped]
Gesendet: Montag, 6. September 2010 15:17
An: Thorsten Heymann
Betreff: Re: Dup Key Error Messages
On Mon, 6 Sep 2010 15:02:24 +0200, Thorsten Heymann <email@example.com>
> Digging through mysqld source, I found this behaviour handled in
> sql/handler.cc and changed from printing key_nr to key.name between this
> versions. :(
> Is there a possible better, reliable way to detect what key is
> as searching in the error message?
Not really. And to make matters worse, this isn't just a version issue.
You'd have the same type of problems if your app connects to a server
installed with a non-Enlish language pack.
The only reliable thing I can think of is to detect that you got an error
1062, then do a db search to find out which field or fields have duplicate
information. Cumbersome, but OTOH you'd also get a chance to realize if
more than one key field is duped.