summaryrefslogtreecommitdiff
path: root/mysql-test/t/limit.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/limit.test')
-rw-r--r--mysql-test/t/limit.test22
1 files changed, 19 insertions, 3 deletions
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index d4f6ce186cf..32962073eee 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -19,9 +19,7 @@ select * from t1;
drop table t1;
create table t1 (i int);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
-insert into t1 (i) values(1);
+insert into t1 (i) values(1),(1),(1);
delete from t1 limit 1;
update t1 set i=2 limit 1;
delete from t1 limit 0;
@@ -29,4 +27,22 @@ update t1 set i=3 limit 0;
select * from t1;
drop table t1;
+# LIMIT 0
+
select 0 limit 0;
+
+#
+# Test with DELETE, ORDER BY and limit (bug #1024)
+#
+
+CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
+INSERT INTO t1 (id2) values (0),(0),(0);
+DELETE FROM t1 WHERE id=1;
+INSERT INTO t1 SET id2=0;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
+# should have deleted WHERE id=2
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
+SELECT * FROM t1;
+DROP TABLE t1;