diff options
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r-- | mysql-test/t/order_by.test | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 1b7d22cc677..d820f1c03bd 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -855,7 +855,8 @@ create table t1(a int, b tinytext); insert into t1 values (1,2),(3,2); set session sort_buffer_size= 1000; set session max_sort_length= 2180; ---error 1038 +CALL mtr.add_suppression("Out of sort memory"); +--error ER_OUT_OF_SORTMEMORY select * from t1 order by b; drop table t1; @@ -1547,3 +1548,27 @@ SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; DROP TABLE t1; --echo End of 5.1 tests + + +--echo # +--echo # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY +--echo # when it should use index +--echo # + +CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY); +CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY); +CREATE TABLE t3 (i3 integer); + +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12); +INSERT INTO t2 SELECT * FROM t1; + +EXPLAIN EXTENDED +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 + LEFT JOIN t3 ON t2.i2 = t3.i3 + ORDER BY t1.i1 LIMIT 5; + +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 + LEFT JOIN t3 ON t2.i2 = t3.i3 + ORDER BY t1.i1 LIMIT 5; + +DROP TABLE t1, t2, t3; |