summaryrefslogtreecommitdiff
path: root/mysql-test/t/delete.test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-05-30 20:48:40 +0300
committerunknown <monty@mysql.com>2005-05-30 20:48:40 +0300
commit16ba85cb9b19fd9ce86b5866f49ff927bbf6a8d6 (patch)
treececbfda09bb93c1c181159eacc7b4e58cac50cf4 /mysql-test/t/delete.test
parent8dc53bc32575c4dc010c3c74caada5dfeb96f321 (diff)
downloadmariadb-git-16ba85cb9b19fd9ce86b5866f49ff927bbf6a8d6.tar.gz
Fixed bug in multiple-table-delete where some rows was not deleted
mysql-test/r/delete.result: Test case for bug in multiple-table-delete where some rows was not deleted mysql-test/t/delete.test: Test case for bug in multiple-table-delete where some rows was not deleted sql/item_subselect.cc: Code cleanup sql/opt_range.cc: Code cleanup sql/sql_delete.cc: Fixed bug in multiple-table-delete where some rows was not deleted This happend when the first table-to-delete-from was not the the table that was scanned. Fixed this by only doing 'delete-on-the-fly' for the first table. Fixed also some wrong error handling in multi-table-delete
Diffstat (limited to 'mysql-test/t/delete.test')
-rw-r--r--mysql-test/t/delete.test19
1 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index a6335d77a0c..265089adfa2 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1,t11,t12,t2;
+drop table if exists t1,t2,t3,t11,t12;
--enable_warnings
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
@@ -152,3 +152,20 @@ INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
DROP TABLE t1;
+
+#
+# Test of multi-delete where we are not scanning the first table
+#
+
+CREATE TABLE t1 (a int not null,b int not null);
+CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
+CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
+insert into t1 values (1,1),(2,1),(1,3);
+insert into t2 values (1,1),(2,2),(3,3);
+insert into t3 values (1,1),(2,1),(1,3);
+select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
+explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
+delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
+# This should be empty
+select * from t3;
+drop table t1,t2,t3;