summaryrefslogtreecommitdiff
path: root/mysql-test/t/group_by.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r--mysql-test/t/group_by.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index afd479c520e..46e58cd00fd 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -489,3 +489,29 @@ 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' order by a,b,c,d 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;
+