[MDEV-13538] better error reporting when FOREIGN KEY CONSTRAINT fails Created: 2017-08-15  Updated: 2021-12-23  Resolved: 2021-12-23

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert, Storage Engine - InnoDB
Affects Version/s: 10.1.26
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Robert Dyas Assignee: Jan Lindström (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

Centos7


Issue Links:
Relates
relates to MDEV-22361 Cross-engine foreign keys support Open

 Description   

We frequently run into a problem where our customers are importing a few thousand records (which we do as a few INSERT statements with maybe 250 rows in a VALUE clause). The problem is that often the file has an issue and we get an error, but tracking down what row is bad is a long process.

A typical error we might receive now looks like this:

Cannot add or update a child row: a foreign key constraint fails (`db11234`.`Campaign_Contacts`, CONSTRAINT `Campaign_Contacts_ibfk_1` FOREIGN KEY (`Party_ID`) REFERENCES `Parties` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE)

It would be SOOOOOO helpful if that error message included something like "for value 123456" so we know which value is causing the problem.

Thank you.



 Comments   
Comment by Jan Lindström (Inactive) [ 2021-12-23 ]

10.1 is EOL.

Generated at Thu Feb 08 08:06:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.