summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2005-03-30 22:11:08 +0300
committerbell@sanja.is.com.ua <>2005-03-30 22:11:08 +0300
commitc64efa6062134675c6cb057fc7412ef1ea3a7a56 (patch)
treeb0584ee1fd2d58e2712a368e83df6dab6bba725d /mysql-test
parentdcdda90a116150f8facceeba75c173451fdc7cf7 (diff)
parent86e3a378ea6e304af41208401c34fa25f4b049c8 (diff)
downloadmariadb-git-c64efa6062134675c6cb057fc7412ef1ea3a7a56.tar.gz
merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ctype_cp1251.result4
-rw-r--r--mysql-test/r/group_by.result25
-rw-r--r--mysql-test/t/ctype_cp1251-master.opt2
-rw-r--r--mysql-test/t/ctype_cp1251.test4
-rw-r--r--mysql-test/t/group_by.test25
5 files changed, 54 insertions, 6 deletions
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 647f8c6236c..c65055e726d 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -1,6 +1,6 @@
drop table if exists t1;
SET NAMES cp1251;
-create table t1 (a varchar(10) not null);
+create table t1 (a varchar(10) not null) character set cp1251;
insert into t1 values ("a"),("ab"),("abc");
select * from t1;
a
@@ -23,7 +23,7 @@ a
b
c
drop table t1;
-create table t1 (a char(15) binary, b binary(15));
+create table t1 (a char(15) binary, b binary(15)) character set cp1251;
insert into t1 values ('aaa','bbb'),('AAA','BBB');
select upper(a),upper(b) from t1;
upper(a) upper(b)
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 7f365eac58a..e4904bb7a04 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -677,3 +677,28 @@ select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
d
10
drop table t1;
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref PRIMARY,a PRIMARY 400 const,const 6 Using where
+select c from t2 where a = 2 and b = 'val-2' group by c;
+c
+val-74
+val-98
+drop table t1,t2;
diff --git a/mysql-test/t/ctype_cp1251-master.opt b/mysql-test/t/ctype_cp1251-master.opt
deleted file mode 100644
index af089d9f176..00000000000
--- a/mysql-test/t/ctype_cp1251-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---default-character-set=cp1251 --new
-
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index 2d670ec3607..76873e6fa0e 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -10,7 +10,7 @@ SET NAMES cp1251;
# Test problem with LEFT() (Bug #514)
#
-create table t1 (a varchar(10) not null);
+create table t1 (a varchar(10) not null) character set cp1251;
insert into t1 values ("a"),("ab"),("abc");
select * from t1;
select a, left(a,1) as b from t1;
@@ -21,7 +21,7 @@ drop table t1;
#
# Test of binary and upper/lower
#
-create table t1 (a char(15) binary, b binary(15));
+create table t1 (a char(15) binary, b binary(15)) character set cp1251;
insert into t1 values ('aaa','bbb'),('AAA','BBB');
select upper(a),upper(b) from t1;
select lower(a),lower(b) from t1;
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;
+