diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 416c583a8d74d0c0a0cd76247c8b287420f92094..6a67bbc6f8ba30b4d3d75ae3cf2bd19027bb5fe5 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1246,3 +1246,16 @@ drop table t1; CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB; CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB; drop table t2,t1; +create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb; +insert into `t1`values ( 1 ) ; +create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb; +insert into `t2`values ( 1 ) ; +create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb; +insert into `t3`values ( 1 ) ; +delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +Cannot delete or update a parent row: a foreign key constraint fails +update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +Cannot delete or update a parent row: a foreign key constraint fails +update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +Unknown table 't1' in where clause +drop table t3,t2,t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 5a18a12507eab7179f11851c8d9251ac54b905be..31be96fc0fd1eff306a3cc1fe526a49601db29f7 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -360,16 +360,3 @@ where 0=1; delete t1, t2 from t2,t1 where t1.id1=t2.id2 and 0=1; drop table t1,t2; -create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb; -insert into `t1`values ( 1 ) ; -create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb; -insert into `t2`values ( 1 ) ; -create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb; -insert into `t3`values ( 1 ) ; -delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -Cannot delete or update a parent row: a foreign key constraint fails -update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -Cannot delete or update a parent row: a foreign key constraint fails -update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -Unknown table 't1' in where clause -drop table t3,t2,t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index ec9aa83ae16d5804297f9793fae9611d7ccf75f3..04642ddd619e798847211d58e0d191bfaa1d6812 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -878,3 +878,21 @@ CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) TYPE=INNODB; CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) TYPE=INNODB; #show create table t2; drop table t2,t1; + +# +# Test of multi updated and foreign keys +# + +create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb; +insert into `t1`values ( 1 ) ; +create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb; +insert into `t2`values ( 1 ) ; +create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb; +insert into `t3`values ( 1 ) ; +--error 1217 +delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +--error 1217 +update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +--error 1109 +update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; +drop table t3,t2,t1; diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test index a12ee7369cb654b0e00799b02bce63ee7479727f..f05f813b06feefafe29462db7e6a1e84bd0e0c0b 100644 --- a/mysql-test/t/lock_tables_lost_commit.test +++ b/mysql-test/t/lock_tables_lost_commit.test @@ -1,5 +1,7 @@ # This is a test for bug 578 +-- source include/have_innodb.inc + connect (con1,localhost,root,,); connect (con2,localhost,root,,); diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 449d58855d99cd7d113603364bd67d470d940a96..be82870cccdb1a113effc17ffed0e9d13bf0680c 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -302,16 +302,3 @@ delete t1, t2 from t2,t1 where t1.id1=t2.id2 and 0=1; drop table t1,t2; -create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb; -insert into `t1`values ( 1 ) ; -create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb; -insert into `t2`values ( 1 ) ; -create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb; -insert into `t3`values ( 1 ) ; ---error 1217 -delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1217 -update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1109 -update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -drop table t3,t2,t1;