Bug #92530 Contribution by Facebook: Add more information to duplicate key error
Submitted: 21 Sep 2018 15:48 Modified: 8 Jul 2019 9:44
Reporter: FBContrib Admin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.6.35 OS:Any
Assigned to: CPU Architecture:Any

[21 Sep 2018 15:48] FBContrib Admin
Description:
Background innformation provided by Facebook:
Abstract:

The current error information for duplicate key lists the key value and key name.  In some scenarios this may not be sufficient.  Add a variable that, when enabled, includes the tablename for the key and the query text (or up to 512 bytes of it) into the error message.  The new variable, improved_dup_key_error, will change the output error message to contain this new information.

Repo: https://github.com/mysql/mysql-server
Patch on top of 5.6.35: https://github.com/mysql/mysql-server/tree/d61eb03ba1b8478d6cb09969ca6c38f330a93178
Facebook commits: https://github.com/facebook/mysql-5.6/commit/2c7f717

How to repeat:
See description

Suggested fix:
See contribution code attached
[21 Sep 2018 15:48] FBContrib Admin
Add more information to duplicate key error 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_81.txt (text/plain), 18.19 KiB.

[5 Nov 2018 19:10] FBContrib Admin
Add more information to duplicate key error addendum 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_87.txt (text/plain), 759 bytes.

[8 Jul 2019 9:44] Jens Even Blomsoy
Posted by developer:
 
Fixed as part of WL#12589 - Add more information to Duplicate Key Error

commit edbd6c8b2b075d987a262916ccd5a7ec89be84a0
Author: Jens Even Berg Blomsoy <jens.even.blomsoy@oracle.com>
Date:   Thu Jul 4 12:16:12 2019 +0200
[9 Sep 2019 21:26] Omer Barnir
Thanks for Facebook for the contribution
[30 Sep 2019 18:59] Paul DuBois
Posted by developer:
 
Fixed in 8.0.19.

Duplicate key error information was extended to include the table
name of the key. Previously, duplicate key error information included
only the key value and key name. Thanks to Facebook for the
contribution.