~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# test sort,min and max on binary fields
3
#
4
--disable_warnings
5
drop table if exists t1,t2;
6
--enable_warnings
7
685.2.2 by Monty Taylor
Fixed binary.
8
# Conflicts between å and ä. Bug#308841
9
#create table t1 (name char(20) not null, primary key (name));
10
#create table t2 (name char(20) binary not null, primary key (name));
11
#insert into t1 values ("å");
12
#insert into t1 values ("ä");
13
#insert into t1 values ("ö");
14
#insert into t2 select * from t1;
15
#
16
#select * from t1 order by name;
17
#select concat("*",name,"*") from t1 order by 1;
18
#select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
19
#select * from t2 order by name;
20
#select concat("*",name,"*") from t2 order by 1;
21
#select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
22
#select name from t1 where name between 'Ä' and 'Ö';
23
#select name from t2 where name between 'ä' and 'ö';
24
#select name from t2 where name between 'Ä' and 'Ö';
25
#
26
#drop table t1,t2;
1 by brian
clean slate
27
28
#
29
# Test of binary and normal strings
30
#
31
1217 by Brian Aker
Removed bits of charset support from the parser.
32
create table t1 (a char(10) not null, b char(10) not null,key (a), key(b));
1 by brian
clean slate
33
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
34
select concat("-",a,"-",b,"-") from t1 where a="hello";
35
select concat("-",a,"-",b,"-") from t1 where a="hello ";
36
select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
37
select concat("-",a,"-",b,"-") from t1 where b="hello";
38
select concat("-",a,"-",b,"-") from t1 where b="hello ";
39
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
40
# blob test
41
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
42
select concat("-",a,"-",b,"-") from t1;
43
select concat("-",a,"-",b,"-") from t1 where b="hello ";
44
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
45
drop table t1;
46
47
#
48
# Test of binary and NULL
49
#
50
create table t1 (b char(8));
51
insert into t1 values(NULL);
52
select b from t1 where binary b like '';
53
select b from t1 group by binary b like '';
54
select b from t1 having binary b like '';
55
drop table t1;
56
57
#
58
# Test of binary and upper/lower
59
#
1217 by Brian Aker
Removed bits of charset support from the parser.
60
create table t1 (a char(3), b varbinary(3));
1 by brian
clean slate
61
insert into t1 values ('aaa','bbb'),('AAA','BBB');
62
select upper(a),upper(b) from t1;
63
select lower(a),lower(b) from t1;
64
select * from t1 where upper(a)='AAA';
65
select * from t1 where lower(a)='aaa';
66
select * from t1 where upper(b)='BBB';
67
select * from t1 where lower(b)='bbb';
68
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
69
drop table t1;
70
71
#
72
# Bug5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
73
#
74
75
create table t1( firstname char(20), lastname char(20));
76
insert into t1 values ("john","doe"),("John","Doe");
77
select * from t1 where firstname='john' and firstname like binary 'john';
78
select * from t1 where firstname='john' and binary 'john' = firstname;
79
select * from t1 where firstname='john' and firstname = binary 'john';
80
select * from t1 where firstname='John' and firstname like binary 'john';
81
select * from t1 where firstname='john' and firstname like binary 'John';
82
drop table t1;
83
84
#
85
# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
86
#
685.2.2 by Monty Taylor
Fixed binary.
87
create table t1 (a char);
942.3.1 by Vladimir Kolesnikov
test generalizations
88
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
89
show create table t1;
90
drop table t1;
685.2.2 by Monty Taylor
Fixed binary.
91
--error 1064
92
create table t2 (a varbinary);
1 by brian
clean slate
93
94
# End of 4.1 tests
95
96
#
97
# Bug#16857
98
#
685.2.2 by Monty Taylor
Fixed binary.
99
create table t1 (col1 char(4));
1 by brian
clean slate
100
insert into t1 values ('a'),('a ');
101
select hex(col1) from t1;
685.2.2 by Monty Taylor
Fixed binary.
102
alter table t1 modify col1 char(10);
1 by brian
clean slate
103
select hex(col1) from t1;
104
insert into t1 values ('b'),('b ');
105
select hex(col1) from t1;
106
drop table t1;
107
108
#
109
# Bug #29087: assertion abort for a search in a BINARY non-nullable index 
110
#             by a key with trailing spaces 
111
#
112
113
CREATE TABLE t1 (
685.2.2 by Monty Taylor
Fixed binary.
114
  a varbinary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 
1 by brian
clean slate
115
  index idx(a)
116
);
117
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
118
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
119
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
120
121
SELECT hex(a) FROM t1 order by a;
122
EXPLAIN SELECT hex(a) FROM t1 order by a;
123
124
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
125
EXPLAIN
126
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
127
128
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
129
130
DROP TABLE t1;
131
132
CREATE TABLE t1 (
133
  id numeric(20) NOT NULL,
134
  lang varchar(8) NOT NULL,
135
  msg varchar(32) NOT NULL,
136
  PRIMARY KEY (id,lang)
137
);
138
INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
139
INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
140
INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
141
SELECT * FROM t1 WHERE id=32;
142
143
DROP TABLE t1;
144