Bug #32866 Error 1216 (23000): Cannot add or update a child row: a foreign key constraint f
Submitted: 30 Nov 2007 8:44 Modified: 30 Dec 2007 9:22
Reporter: Satish Yanamadala Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S1 (Critical)
Version:4.1.9-max OS:Windows
Assigned to: CPU Architecture:Any

[30 Nov 2007 8:44] Satish Yanamadala
Description:
I have tried to populate the table using "LOAD DATA" command, but it seems prompting the
error " Error 1216 (23000): Cannot add or update a child row: a foreign key constraint fails"

However if i use "Insert.....statement" to insert the data,it manage to insert successfully.

Why is this so ?

My tables are as follows :-

connections ( table )
id
connectionName
processor
Architecture

connections_testscripts ( join table )

connection_id ( Foreign Key ) 
testscript_id ( Foreign Key )

testsctipts  ( table )
id 
testName 

Iam trying to load into connections_testscripts table ?

Issue # 2 :-
How to increase the number of constraints that can be defined on a particular table column. 

How to repeat:
Create two tables and one join table to define many-to-many relationship between them.

Try to populate the table using " LOAD DATA " command.

U will observe the following error message :-
" Error 1216 (23000): Cannot add or update a child row: a foreign key constraint fails"

If we try to load using "Insert statement".

I verified that the data which iam entering is valid .
[30 Nov 2007 8:52] Sveta Smirnova
Thank you for the report.

Please indicate accurate version of MySQL server you use.
[30 Nov 2007 9:03] Satish Yanamadala
I am using mySQL which comes along with Ruby-on-Rails
[30 Nov 2007 9:07] Sveta Smirnova
Thank you for the feedback.

But version 4.1.9 is very old. Please upgrade to current version 4.1.22, try with it and say us if problem still exists.
[30 Nov 2007 9:11] Satish Yanamadala
Any suggestion regarding my issue # 2
How to increase the number of constraints that can be defined on a particular table column.
[30 Nov 2007 9:22] Sveta Smirnova
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

So only problem we can discuss here is failure of LOAD DATA INFILE due to foreign key constraint checks if INSERT works fine with same data and only if problem exists in up to date version of MySQL.
[1 Jan 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".