WL#12589: Add more information to Duplicate Key Error

Affects: Server-8.0   —   Status: Complete

The error "Duplicate entry xxx for key 1" it is sometimes difficult to pinpoint 
the origins of. The current error information for duplicate key lists the key 
value and key name. In some scenarios this is not sufficient.

This worklog extends the error information given in cases of DUP_ENTRY_KEY to 
include the tablename for the key into the error message.


This worklog is related to:
BUG#92530 Contribution by Facebook: Add more information to duplicate key error

and

BUG#47207 Not enough information in error Duplicate entry xxx for key 1
Functional requirements
=======================

F1) Tablename of the duplicate key should be written to the log.

F2) No unwanted leakage of information should be written to the log.

F3) No new options should be introduced.
Adding more information to the duplicate key error had some deviations from the 
original proposal from Facebook. 

1. Having an option to increase the information about the duplicate key error 
was not wanted, due to the fact that MySQL already has a lot of options and going 
forward, the less small options the better. 
 
 -The extended duplicate key error is now default.

2. Having the query text appended to the error message is something we usually 
not do. Because of several things, verbosity in the error log and due to unwanted  
information leakage.  
 
 -There is no query text appended to the error message. 


3. Extending ER_DUP_ENTRY_WITH_KEY_NAME to take the increased number of 
characters. 

 -ER_DUP_ENTRY_WITH_KEY_NAME 
  eng "Duplicate entry '%-.64s' for key '%-.385s."