Chuck, ----- Original Message ----- From: "Chuck Simmons" <[EMAIL PROTECTED]> Newsgroups: mailing.database.mysql Sent: Tuesday, July 09, 2002 4:29 AM Subject: possible bug: alter table trashed foreign key constraints in innodb
> sql query > > In version 3.23.49a when using an innodb table, "alter table" appears to > corrupt foreign key constraints. Try the following test case: > > " > create table test_base ( > base_id int not null, > primary key (base_id) > ) type = innodb; > > create table test_ref ( > base_id int not null, > ref_id int not null, > primary key (base_id, ref_id), > foreign key (base_id) references test_base (base_id) > ) type = innodb; > > insert test_base (base_id) values (1); > insert test_ref (base_id, ref_id) values (1, 1); > > alter table test_base add column value int not null; > > insert test_ref (base_id, ref_id) values (1, 2); > " > > The final insert fails with > " > mysql> insert test_ref (base_id, ref_id) values (1, 2); > ERROR 1216: Cannot add a child row: a foreign key constraint fails > " > > which suggests that the foreign key constraint has become hosed? the fact that ALTER TABLE spoiled foreign key definitions was a documented bug. It was fixed in 3.23.50. > Chuck Best regards, Heikki Tuuri Innobase Oy --- Order technical MySQL/InnoDB support at https://order.mysql.com/ See http://www.innodb.com for the online manual and latest news on InnoDB --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php