Comment 0 for bug 1586122

Revision history for this message
Justin Gronfur (justin-gronfur) wrote : ON DUPLICATE KEY UPDATE causes foreign key errors to be reported as duplicate key entry error

I recently updated a system to Percona Server 5.6.30-76.3 and had some code that relied on the incorrect behavior fixed by http://bugs.mysql.com/bug.php?id=78853

While updating that code to use INSERT ... ON DUPLICATE KEY UPDATE instead of INSERT IGNORE I noticed that foreign key constraint failures (ERROR 1452) are being incorrectly returned as duplicate entry (ERROR 1062). Please see the attached bug.txt that walks through a simple reproduction of the bug.

The seems to have been introduced in 5.6.30-76.3 as I have not be able to reproduce it in any other version.