By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
noone has an idea ?

Dec 9 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.