diff options
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r-- | mysql-test/t/order_by.test | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index bbb0046b47f..9ae9c1b5e12 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -347,6 +347,23 @@ SELECT * FROM t1 ORDER BY (a + b) DESC; DROP TABLE t1; # +# Test of FORCE INDEX ... ORDER BY +# + +create table t1(id int not null auto_increment primary key, t char(12)); +disable_query_log; +let $1 = 1000; +while ($1) + { + eval insert into t1(t) values ('$1'); + dec $1; + } +enable_query_log; +explain select id,t from t1 order by id; +explain select id,t from t1 force index (primary) order by id; +drop table t1; + +# # Test of test_if_subkey() function # CREATE TABLE t1 ( @@ -393,3 +410,28 @@ select * from t1 where b=1 or b is null order by a; explain select * from t1 where b=2 or b is null order by a; select * from t1 where b=2 or b is null order by a; drop table t1; + +# +# Bug #3155 - Strange results with index (x, y) ... WHERE ... ORDER BY pk +# + +create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null, +key(a,b,d), key(c,b,a)); +create table t2 like t1; +insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3); +insert into t2 select null, b, c, d from t1; +insert into t1 select null, b, c, d from t2; +insert into t2 select null, b, c, d from t1; +insert into t1 select null, b, c, d from t2; +insert into t2 select null, b, c, d from t1; +insert into t1 select null, b, c, d from t2; +insert into t2 select null, b, c, d from t1; +insert into t1 select null, b, c, d from t2; +insert into t2 select null, b, c, d from t1; +insert into t1 select null, b, c, d from t2; +optimize table t1; +set @row=10; +insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10; +select * from t1 where a=1 and b in (1) order by c, b, a; +select * from t1 where a=1 and b in (1); +drop table t1, t2; |