Bug #6401 Need better error messages for failed constraints
Submitted: 3 Nov 2004 13:03 Modified: 12 Aug 2005 9:58
Reporter: Markus Fischer Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[3 Nov 2004 13:03] Markus Fischer
Description:
The error messages from failed constraints are not very helpful. Especially with large database it would help to exactly know where a certain constrain did fail.

Take this error messages as an example:
Error with SQL Statement: 'INSERT INTO kunden(ku_kt_id_titel,ku_nachname,ku_vorname,ku_kundennummer,ku_email,ku_ka_id_anrede,ku_strasse,ku_hausnr,ku_plz,ku_or_id_ort,ku_telefon_whg,ku_telefon_buero,ku_telefon_mobil,ku_fax_whg,ku_fax_buero,ku_tour,ku_ordnungszahl,ku_lieferbeginn,ku_liefersumme,ku_offener_betrag,ku_schluessel,ku_bis_spaetestens,ku_bank,ku_blz,ku_kontonummer,ku_zm_id_zahlungsmodus) VALUES('1','Nachname','','','','1','','','','0','','','','','','','','','','','0','','','','','1')': Cannot add or update a child row: a foreign key constraint fails

Question: which foreign key constraint did fail?

In this case the table has seven contraints. For me as a developer using MySQL i would expect the error message to tell me, which constraints did fail.

How to repeat:
A repeatable example is not needed. Any insert with failed constraints is sufficient to see where the error message lacks the important details.
[3 Nov 2004 13:17] Heikki Tuuri
Hi!

SHOW INNODB STATUS gives a very detailed explanation of the latest FOREIGN KEY error in the database server.

A better error message directly to the client is in the TODO.

I am assigning this feature request to Jan Lindström.

Best regards,

Heikki
[3 Nov 2004 13:26] Markus Fischer
Thank you, your comment saved my day!
[12 Aug 2005 9:58] Osku Salerma
Duplicate of #3443.