471,870 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,870 software developers and data experts.

"ERROR 1216: Cannot add or update a child row" but parent record exists

Hi,

With mysql-4.0.20, I have a problem inserting data with foreign key
references, MySQL saying ERROR 1216: Cannot add or update a child row:
a foreign key constraint fails

The message is confusing because a parent record in parent table exists
!?

The "show innodb status; " command prints :
CONSTRAINT `C67125` FOREIGN KEY (`affaire_ref`) REFERENCES `affaire`
(`reference`) ON DELETE CASCADE ON UPDATE CASCADE
Trying to add to index `consultation_ref` tuple:
DATA TUPLE: 2 fields;
0: len 23; hex 544553545f4154585f32202d20414f4f202d2041415043; asc
TEST_AT;; 1: len 4; hex 8000000d; asc ;;

But the parent table `AJAO/affaire` does not currently exist!

Any help would be appreciated.

Regards

Dec 8 '05 #1
3 5237
Hi!

Please check that the case of letters in the parent table name AJAO.affaire
is correct. InnoDB says that such table does not exist. Note that in MySQL's
Unix version, table names are case-sensitive.

Best regards,

Heikki

Oracle Corp./Innobase Oy
InnoDB - transactions, row level locking, and foreign keys for MySQL

InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM
tables
http://www.innodb.com/order.php
<fu*****@yahoo.fr> kirjoitti
viestissä:11**********************@g47g2000cwa.goo glegroups.com...
Hi,

With mysql-4.0.20, I have a problem inserting data with foreign key
references, MySQL saying ERROR 1216: Cannot add or update a child row:
a foreign key constraint fails

The message is confusing because a parent record in parent table exists
!?

The "show innodb status; " command prints :
CONSTRAINT `C67125` FOREIGN KEY (`affaire_ref`) REFERENCES `affaire`
(`reference`) ON DELETE CASCADE ON UPDATE CASCADE
Trying to add to index `consultation_ref` tuple:
DATA TUPLE: 2 fields;
0: len 23; hex 544553545f4154585f32202d20414f4f202d2041415043; asc
TEST_AT;; 1: len 4; hex 8000000d; asc ;;

But the parent table `AJAO/affaire` does not currently exist!

Any help would be appreciated.

Regards

Dec 8 '05 #2
the table AJAO.affaire is correct but ajao.affaire exists too. Do you
think it is a problem having the two databases AJAO and ajao ?

Dec 9 '05 #3
noone has an idea ?

Dec 9 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mark | last post: by
20 posts views Thread by Mark Harrison | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.