Loading mysql-test/r/innodb_mysql.result +16 −0 Original line number Diff line number Diff line Loading @@ -295,6 +295,22 @@ b c d drop table t1,t4; DROP TABLE IF EXISTS t2, t1; CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); DELETE IGNORE FROM t1 WHERE i = 1; Warnings: Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION) SELECT * FROM t1, t2; i i 1 1 DROP TABLE t2, t1; End of 4.1 tests. create table t1 ( a varchar(30), b varchar(30), primary key(a), key(b) ) engine=innodb; Loading mysql-test/t/innodb_mysql.test +30 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,36 @@ select distinct a1 from t4 where pk_col not in (1,2,3,4); drop table t1,t4; # # BUG#18819: DELETE IGNORE hangs on foreign key parent delete # # The bug itself does not relate to InnoDB, but we have to use foreign # keys to reproduce it. # --disable_warnings DROP TABLE IF EXISTS t2, t1; --enable_warnings CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); DELETE IGNORE FROM t1 WHERE i = 1; SELECT * FROM t1, t2; DROP TABLE t2, t1; --echo End of 4.1 tests. # # Bug #6142: a problem with the empty innodb table # (was part of group_min_max.test) Loading sql/sql_delete.cc +1 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, mysql_unlock_tables(thd, thd->lock); thd->lock=0; } if (error < 0) if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error)) { thd->row_count_func= deleted; send_ok(thd,deleted); Loading Loading
mysql-test/r/innodb_mysql.result +16 −0 Original line number Diff line number Diff line Loading @@ -295,6 +295,22 @@ b c d drop table t1,t4; DROP TABLE IF EXISTS t2, t1; CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); DELETE IGNORE FROM t1 WHERE i = 1; Warnings: Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION) SELECT * FROM t1, t2; i i 1 1 DROP TABLE t2, t1; End of 4.1 tests. create table t1 ( a varchar(30), b varchar(30), primary key(a), key(b) ) engine=innodb; Loading
mysql-test/t/innodb_mysql.test +30 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,36 @@ select distinct a1 from t4 where pk_col not in (1,2,3,4); drop table t1,t4; # # BUG#18819: DELETE IGNORE hangs on foreign key parent delete # # The bug itself does not relate to InnoDB, but we have to use foreign # keys to reproduce it. # --disable_warnings DROP TABLE IF EXISTS t2, t1; --enable_warnings CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB; CREATE TABLE t2 ( i INT NOT NULL, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION ) ENGINE= InnoDB; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); DELETE IGNORE FROM t1 WHERE i = 1; SELECT * FROM t1, t2; DROP TABLE t2, t1; --echo End of 4.1 tests. # # Bug #6142: a problem with the empty innodb table # (was part of group_min_max.test) Loading
sql/sql_delete.cc +1 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, mysql_unlock_tables(thd, thd->lock); thd->lock=0; } if (error < 0) if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error)) { thd->row_count_func= deleted; send_ok(thd,deleted); Loading