summaryrefslogtreecommitdiff
path: root/mysql-test/t/binary.test
blob: 4f9ac7581d2bd0b4f779d36e6ae94410f8b338b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# test sort,min and max on binary fields
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings

create table t1 (name char(20) not null, primary key (name));
create table t2 (name char(20) binary not null, primary key (name));
insert into t1 values ("å");
insert into t1 values ("ä");
insert into t1 values ("ö");
insert into t2 select * from t1;

select * from t1 order by name;
select concat("*",name,"*") from t1 order by 1;
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
select * from t2 order by name;
select concat("*",name,"*") from t2 order by 1;
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
select name from t1 where name between 'Ä' and 'Ö';
select name from t2 where name between 'ä' and 'ö';
select name from t2 where name between 'Ä' and 'Ö';

drop table t1,t2;

#
# Test of binary and normal strings
#

create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
select * from t1 where a="hello";
select * from t1 where a="hello ";
select * from t1 ignore index (a) where a="hello ";
select * from t1 where b="hello";
select * from t1 where b="hello ";
select * from t1 ignore index (b) where b="hello ";
# blob test
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
select * from t1 where b="hello ";
select * from t1 ignore index (b) where b="hello ";
drop table t1;

#
# Test of binary and NULL
#
create table t1 (b char(8));
insert into t1 values(NULL);
select b from t1 where binary b like '';
select b from t1 group by binary b like '';
select b from t1 having binary b like '';
drop table t1;