summaryrefslogtreecommitdiff
path: root/mysql-test/t/delete.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/delete.test')
-rw-r--r--mysql-test/t/delete.test54
1 files changed, 51 insertions, 3 deletions
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 07cb9155b3f..5f60445d765 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -2,7 +2,9 @@
# Check for problems with delete
#
-drop table if exists t1;
+--disable_warnings
+drop table if exists t1,t11,t12,t2;
+--enable_warnings
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
@@ -36,6 +38,15 @@ insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(2
delete from t1 where a=27;
drop table t1;
+CREATE TABLE `t1` (
+ `i` int(10) NOT NULL default '0',
+ `i2` int(10) NOT NULL default '0',
+ PRIMARY KEY (`i`)
+);
+-- error 1054
+DELETE FROM t1 USING t1 WHERE post='1';
+drop table t1;
+
#
# CHAR(0) bug - not actually DELETE bug, but anyway...
#
@@ -45,7 +56,7 @@ CREATE TABLE t1 (
not_null varchar(20) binary NOT NULL default '',
misc integer not null,
PRIMARY KEY (not_null)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
@@ -60,7 +71,6 @@ delete from t1 where 3 > 2;
select count(*) from t1;
drop table t1;
-
#
# Bug #5733: Table handler error with self-join multi-table DELETE
#
@@ -71,3 +81,41 @@ select * from t1;
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
select * from t1;
drop table t1;
+
+#
+# IGNORE option
+#
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(0, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+select * from t12;
+select * from t2;
+-- error 1242
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+select * from t12;
+delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+select * from t12;
+insert into t11 values (2, 12);
+-- error 1242
+delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
+select * from t11;
+drop table t11, t12, t2;
+
+#
+# Bug #4198: deletion and KEYREAD
+#
+
+create table t1 (a int, b int, unique key (a), key (b));
+insert into t1 values (3, 3), (7, 7);
+delete t1 from t1 where a = 3;
+check table t1;
+select * from t1;
+drop table t1;