diff options
author | Michael Widenius <monty@askmonty.org> | 2010-03-10 15:39:02 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-03-10 15:39:02 +0200 |
commit | 77afc2be46e0a815357795a0ab0977115c8a313d (patch) | |
tree | 9073744695c84278cfca2d72d6422c09a00ea72e /mysql-test/r | |
parent | 292f6568fa377420c81e0317a26b804057ce208c (diff) | |
download | mariadb-git-77afc2be46e0a815357795a0ab0977115c8a313d.tar.gz |
Fix for: Bug#44987 DELETE IGNORE and FK constraint
- Now DELETE IGNORE skips over rows with a foreign key constraints (as it was supposed to do)
mysql-test/r/foreign_key.result:
Test case for Bug#44987 DELETE IGNORE and FK constraint
mysql-test/t/foreign_key.test:
Test case for Bug#44987 DELETE IGNORE and FK constraint
sql/sql_delete.cc:
Firx for Bug#44987 DELETE IGNORE and FK constraint
Now DELETE IGNORE skips over rows with a foreign key constraints (as it was supposed to do)
Bug fix inspired by: Moritz Mertinkat
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/foreign_key.result | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result index ece53db2e9a..411252e0a5d 100644 --- a/mysql-test/r/foreign_key.result +++ b/mysql-test/r/foreign_key.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 ( a int not null references t2, b int not null references t2 (c), @@ -13,3 +13,30 @@ foreign key (a,b) references t3 (c,d) on update set null); create index a on t1 (a); create unique index b on t1 (a,b); drop table t1; +create table t1 (id int primary key) engine = innodb; +create table t2 (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES t1(id)) engine=innodb; +insert into t1 values (1), (2), (3), (4), (5), (6); +insert into t2 values (3), (5); +delete from t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) +select * from t1; +id +1 +2 +3 +4 +5 +6 +delete ignore from t1; +Warnings: +Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) +Error 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) +select row_count(); +row_count() +-1 +select * from t1; +id +3 +5 +drop table t2; +drop table t1; |