~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/endspace.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test problem with characters < ' ' at end of strings (Bug #3152)
 
3
#
 
4
 
 
5
-- source include/have_innodb.inc
 
6
--disable_warnings
 
7
drop table if exists t1;
 
8
--enable_warnings
 
9
 
 
10
-- source include/endspace.inc
 
11
 
 
12
#
 
13
# Test MyISAM tables.
 
14
#
 
15
 
 
16
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
 
17
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
 
18
check table t1;
 
19
select * from t1 ignore key (key1) where text1='teststring' or 
 
20
  text1 like 'teststring_%' ORDER BY text1;
 
21
select * from t1 where text1='teststring' or text1 like 'teststring_%';
 
22
select * from t1 where text1='teststring' or text1 > 'teststring\t';
 
23
select * from t1 order by text1;
 
24
explain select * from t1 order by text1;
 
25
 
 
26
alter table t1 modify text1 char(32) binary not null;
 
27
check table t1;
 
28
select * from t1 ignore key (key1) where text1='teststring' or 
 
29
  text1 like 'teststring_%' ORDER BY text1;
 
30
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
 
31
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
 
32
select text1, length(text1) from t1 order by text1;
 
33
select text1, length(text1) from t1 order by binary text1;
 
34
 
 
35
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
 
36
insert into t1 values ('teststring ');
 
37
select concat('|', text1, '|') from t1 order by text1;
 
38
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
 
39
select concat('|', text1, '|') from t1 where text1='teststring';
 
40
select concat('|', text1, '|') from t1 where text1='teststring ';
 
41
 
 
42
alter table t1 modify text1 text not null, pack_keys=1;
 
43
select concat('|', text1, '|') from t1 where text1='teststring';
 
44
select concat('|', text1, '|') from t1 where text1='teststring ';
 
45
explain select concat('|', text1, '|') from t1 where text1='teststring ';
 
46
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
 
47
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
 
48
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
 
49
select concat('|', text1, '|') from t1 order by text1;
 
50
drop table t1;
 
51
 
 
52
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
 
53
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
 
54
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
 
55
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
 
56
drop table t1;
 
57
 
 
58
# Test HEAP tables (with BTREE keys)
 
59
 
 
60
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
 
61
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
 
62
select * from t1 ignore key (key1) where text1='teststring' or 
 
63
  text1 like 'teststring_%' ORDER BY text1;
 
64
select * from t1 where text1='teststring' or text1 like 'teststring_%';
 
65
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
 
66
select * from t1 order by text1;
 
67
explain select * from t1 order by text1;
 
68
 
 
69
alter table t1 modify text1 char(32) binary not null;
 
70
select * from t1 order by text1;
 
71
drop table t1;
 
72
 
 
73
#
 
74
# Test InnoDB tables
 
75
#
 
76
 
 
77
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
 
78
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
 
79
check table t1;
 
80
select * from t1 where text1='teststring' or text1 like 'teststring_%';
 
81
select * from t1 where text1='teststring' or text1 > 'teststring\t';
 
82
select * from t1 order by text1;
 
83
explain select * from t1 order by text1;
 
84
 
 
85
alter table t1 modify text1 char(32) binary not null;
 
86
select * from t1 order by text1;
 
87
 
 
88
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
 
89
insert into t1 values ('teststring ');
 
90
select concat('|', text1, '|') from t1 order by text1;
 
91
 
 
92
alter table t1 modify text1 text not null, pack_keys=1;
 
93
select * from t1 where text1 like 'teststring_%';
 
94
 
 
95
# The following gives wrong result in InnoDB
 
96
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
 
97
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
 
98
select concat('|', text1, '|') from t1 order by text1;
 
99
drop table t1;
 
100
 
 
101
# End of 4.1 tests