diff options
author | kroki/tomash@moonlight.intranet <> | 2006-10-25 20:00:51 +0400 |
---|---|---|
committer | kroki/tomash@moonlight.intranet <> | 2006-10-25 20:00:51 +0400 |
commit | c8bb2f396ac0abe96b279c34a9bb0de70065c59a (patch) | |
tree | a77b1da0175533da33a64424702c5d13e6731bb3 | |
parent | 76c5979f9ed14b8e2d2856a5ff0f60630f13aa5e (diff) | |
parent | b7b991cec395da1cf3277b00df9328c0b6a1b7fa (diff) | |
download | mariadb-git-c8bb2f396ac0abe96b279c34a9bb0de70065c59a.tar.gz |
Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug18819
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug18819
-rw-r--r-- | mysql-test/r/innodb_mysql.result | 17 | ||||
-rw-r--r-- | mysql-test/t/innodb_mysql.test | 30 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 |
3 files changed, 48 insertions, 1 deletions
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index b4101e037f2..cc0fc4289dc 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -295,6 +295,23 @@ 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 1217 Cannot delete or update a parent row: a foreign key constraint fails +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; diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 59dbe5e96d4..7340f80cc78 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -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) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c95fb5d5973..3384a77c3ab 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -317,7 +317,7 @@ cleanup: 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); |