summaryrefslogtreecommitdiff
path: root/mysql-test/t/order_by.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r--mysql-test/t/order_by.test34
1 files changed, 32 insertions, 2 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index e725e107c48..1b7d22cc677 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -1,11 +1,17 @@
#
-# Bug with order by
+# Testing ORDER BY
#
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
+
+#
+# Test old ORDER BY bug
+#
+
CREATE TABLE t1 (
id int(6) DEFAULT '0' NOT NULL,
idservice int(5),
@@ -853,7 +859,6 @@ set session max_sort_length= 2180;
select * from t1 order by b;
drop table t1;
-
--echo #
--echo # Bug #39844: Query Crash Mysql Server 5.0.67
--echo #
@@ -1368,6 +1373,14 @@ SELECT d FROM t3 AS t1, t2 AS t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
+SELECT t1.*,t2.* FROM t1, t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 5;
+
+SELECT t1.*, t2.* FROM t3 AS t1, t2 AS t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 5;
+
DROP TABLE t1,t2,t3;
@@ -1516,4 +1529,21 @@ SELECT * FROM t1 r JOIN t1 s ON r.a = s.a
DROP TABLE t1;
+--echo #
+--echo # Bug #59110: Memory leak of QUICK_SELECT_I allocated memory
+--echo # and
+--echo # Bug #59308: Incorrect result for
+--echo SELECT DISTINCT <col>... ORDER BY <col> DESC
+--echo
+--echo # Use Valgrind to detect #59110!
+--echo #
+
+CREATE TABLE t1 (a INT,KEY (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
+SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests