diff options
author | unknown <sergefp@mysql.com> | 2005-03-30 15:57:42 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-03-30 15:57:42 +0400 |
commit | 5ac4670bf7f17374e8bae1bd27625ccabc1eac82 (patch) | |
tree | f1b5f4d005ed6b67c11d3881df26610ec2f06acc /mysql-test/t/group_by.test | |
parent | 633a2468ec3407d1900b6cce276cc80a89d978a6 (diff) | |
download | mariadb-git-5ac4670bf7f17374e8bae1bd27625ccabc1eac82.tar.gz |
Fix for BUG#9213: GROUP BY returns wrong query results:
Make test_if_skip_sort_order() rebuild tab->ref if it decides to use an index
different from the index join optimizer has choosen.
mysql-test/r/group_by.result:
Testcase for BUG#9213
mysql-test/t/group_by.test:
Testcase for BUG#9213
sql/table.h:
Added comments about TABLE::used_keys
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r-- | mysql-test/t/group_by.test | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index afd479c520e..327be1b724b 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -489,3 +489,28 @@ select a,sum(b) from t1 where a=1 group by c having a=1; select a as d,sum(b) from t1 where a=1 group by c having d=1; select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0; drop table t1; + +# Test for BUG#9213 GROUP BY query on utf-8 key returns wrong results +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(8),(9); +create table t2 ( + a int, + b varchar(200) NOT NULL, + c varchar(50) NOT NULL, + d varchar(100) NOT NULL, + primary key (a,b(132),c,d), + key a (a,b) +) charset=utf8; + +insert into t2 select + x3.a, -- 3 + concat('val-', x3.a + 3*x4.a), -- 12 + concat('val-', @a:=x3.a + 3*x4.a + 12*C.a), -- 120 + concat('val-', @a + 120*D.a) +from t1 x3, t1 x4, t1 C, t1 D where x3.a < 3 and x4.a < 4 and D.a < 4; +delete from t2 where a = 2 and b = 'val-2' limit 30; + +explain select c from t2 where a = 2 and b = 'val-2' group by c; +select c from t2 where a = 2 and b = 'val-2' group by c; +drop table t1,t2; + |