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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
--disable_warnings
drop table if exists `T1`;
drop table if exists `T2`;
drop table if exists `T3`;
drop table if exists `T4`;
drop table if exists `T5`;
drop table if exists `T6`;
drop table if exists `T7`;
drop table if exists `T8`;
drop table if exists `T9`;
drop table if exists `T10`;
--enable_warnings
#
# Test TRIM() function with Japanese characters utf8 encoding
#
SET NAMES utf8;
SET character_set_database = utf8;
CREATE TABLE `T1` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `T2` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `T3` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `T4` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `T5` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `T6` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `T7` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `T8` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `T9` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `T10` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
CREATE TABLE `T11` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
CREATE TABLE `T12` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
# Nothing to trim
INSERT INTO `T1` VALUES ('アイウエオ');
# Test data for TRIM(TRAILING [remstr] FROM str)
INSERT INTO `T1` VALUES ('アイウエオカ');
INSERT INTO `T1` VALUES ('アイウエオカカ');
INSERT INTO `T1` VALUES ('アイウエオカカカ');
# Test data for TRIM(LEADING [remstr] FROM str)
INSERT INTO `T1` VALUES ('カアイウエオ');
INSERT INTO `T1` VALUES ('カカアイウエオ');
INSERT INTO `T1` VALUES ('カカカアイウエオ');
# Test data for TRIM(BOTH [remstr] FROM str)
INSERT INTO `T1` VALUES ('カカカアイウエオカカカ');
# Test data for TRIM without [remstr] (remove spaces)
INSERT INTO `T1` VALUES (' アイウエオ ');
INSERT INTO `T2` VALUES ('あいうえお');
INSERT INTO `T2` VALUES ('あいうえおか');
INSERT INTO `T2` VALUES ('あいうえおかか');
INSERT INTO `T2` VALUES ('あいうえおかかか');
INSERT INTO `T2` VALUES ('かあいうえお');
INSERT INTO `T2` VALUES ('かかあいうえお');
INSERT INTO `T2` VALUES ('かかかあいうえお');
INSERT INTO `T2` VALUES ('かかかあいうえおかかか');
INSERT INTO `T2` VALUES (' あいうえお ');
INSERT INTO `T3` VALUES ('龔龖龗龞龡');
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂');
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂');
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂丂');
INSERT INTO `T3` VALUES ('丂龔龖龗龞龡');
INSERT INTO `T3` VALUES ('丂丂龔龖龗龞龡');
INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡');
INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
INSERT INTO `T3` VALUES (' 龔龖龗龞龡 ');
INSERT INTO `T4` VALUES ('アイウエオ');
INSERT INTO `T4` VALUES ('アイウエオカ');
INSERT INTO `T4` VALUES ('アイウエオカカ');
INSERT INTO `T4` VALUES ('アイウエオカカカ');
INSERT INTO `T4` VALUES ('カアイウエオ');
INSERT INTO `T4` VALUES ('カカアイウエオ');
INSERT INTO `T4` VALUES ('カカカアイウエオ');
INSERT INTO `T4` VALUES ('カカカアイウエオカカカ');
INSERT INTO `T4` VALUES (' アイウエオ ');
INSERT INTO `T5` VALUES ('あいうえお');
INSERT INTO `T5` VALUES ('あいうえおか');
INSERT INTO `T5` VALUES ('あいうえおかか');
INSERT INTO `T5` VALUES ('あいうえおかかか');
INSERT INTO `T5` VALUES ('かあいうえお');
INSERT INTO `T5` VALUES ('かかあいうえお');
INSERT INTO `T5` VALUES ('かかかあいうえお');
INSERT INTO `T5` VALUES ('かかかあいうえおかかか');
INSERT INTO `T5` VALUES (' あいうえお ');
INSERT INTO `T6` VALUES ('龔龖龗龞龡');
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂');
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂');
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂丂');
INSERT INTO `T6` VALUES ('丂龔龖龗龞龡');
INSERT INTO `T6` VALUES ('丂丂龔龖龗龞龡');
INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡');
INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
INSERT INTO `T6` VALUES (' 龔龖龗龞龡 ');
INSERT INTO `T7` VALUES ('アイウエオ');
INSERT INTO `T7` VALUES ('アイウエオカ');
INSERT INTO `T7` VALUES ('アイウエオカカ');
INSERT INTO `T7` VALUES ('アイウエオカカカ');
INSERT INTO `T7` VALUES ('カアイウエオ');
INSERT INTO `T7` VALUES ('カカアイウエオ');
INSERT INTO `T7` VALUES ('カカカアイウエオ');
INSERT INTO `T7` VALUES ('カカカアイウエオカカカ');
INSERT INTO `T7` VALUES (' アイウエオ ');
INSERT INTO `T8` VALUES ('あいうえお');
INSERT INTO `T8` VALUES ('あいうえおか');
INSERT INTO `T8` VALUES ('あいうえおかか');
INSERT INTO `T8` VALUES ('あいうえおかかか');
INSERT INTO `T8` VALUES ('かあいうえお');
INSERT INTO `T8` VALUES ('かかあいうえお');
INSERT INTO `T8` VALUES ('かかかあいうえお');
INSERT INTO `T8` VALUES ('かかかあいうえおかかか');
INSERT INTO `T8` VALUES (' あいうえお ');
INSERT INTO `T9` VALUES ('龔龖龗龞龡');
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂');
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂');
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂丂');
INSERT INTO `T9` VALUES ('丂龔龖龗龞龡');
INSERT INTO `T9` VALUES ('丂丂龔龖龗龞龡');
INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡');
INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
INSERT INTO `T9` VALUES (' 龔龖龗龞龡 ');
INSERT INTO `T10` VALUES ('アイウエオ');
INSERT INTO `T10` VALUES ('アイウエオカ');
INSERT INTO `T10` VALUES ('アイウエオカカ');
INSERT INTO `T10` VALUES ('アイウエオカカカ');
INSERT INTO `T10` VALUES ('カアイウエオ');
INSERT INTO `T10` VALUES ('カカアイウエオ');
INSERT INTO `T10` VALUES ('カカカアイウエオ');
INSERT INTO `T10` VALUES ('カカカアイウエオカカカ');
INSERT INTO `T10` VALUES (' アイウエオ ');
INSERT INTO `T11` VALUES ('あいうえお');
INSERT INTO `T11` VALUES ('あいうえおか');
INSERT INTO `T11` VALUES ('あいうえおかか');
INSERT INTO `T11` VALUES ('あいうえおかかか');
INSERT INTO `T11` VALUES ('かあいうえお');
INSERT INTO `T11` VALUES ('かかあいうえお');
INSERT INTO `T11` VALUES ('かかかあいうえお');
INSERT INTO `T11` VALUES ('かかかあいうえおかかか');
INSERT INTO `T11` VALUES (' あいうえお ');
INSERT INTO `T12` VALUES ('龔龖龗龞龡');
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂');
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂丂');
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂丂丂');
INSERT INTO `T12` VALUES ('丂龔龖龗龞龡');
INSERT INTO `T12` VALUES ('丂丂龔龖龗龞龡');
INSERT INTO `T12` VALUES ('丂丂丂龔龖龗龞龡');
INSERT INTO `T12` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
INSERT INTO `T12` VALUES (' 龔龖龗龞龡 ');
#InnoDB
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T1`;
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T1`;
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T1`;
SELECT `C1`,TRIM(`C1`) FROM `T1`;
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T2`;
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T2`;
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T2`;
SELECT `C1`,TRIM(`C1`) FROM `T2`;
SELECT `C1`,TRIM(TRAILING '丂'FROM `C1`) FROM `T3`;
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T3`;
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T3`;
SELECT `C1`,TRIM(`C1`) FROM `T3`;
#MyISAM
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T4`;
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T4`;
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T4`;
SELECT `C1`,TRIM(`C1`) FROM `T4`;
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T5`;
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T5`;
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T5`;
SELECT `C1`,TRIM(`C1`) FROM `T5`;
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T6`;
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T6`;
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T6`;
SELECT `C1`,TRIM(`C1`) FROM `T6`;
#HEAP
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T7`;
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T7`;
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T7`;
SELECT `C1`,TRIM(`C1`) FROM `T7`;
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T8`;
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T8`;
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T8`;
SELECT `C1`,TRIM(`C1`) FROM `T8`;
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T9`;
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T9`;
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T9`;
SELECT `C1`,TRIM(`C1`) FROM `T9`;
#BDB
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T10`;
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T10`;
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T10`;
SELECT `C1`,TRIM(`C1`) FROM `T10`;
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T11`;
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T11`;
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T11`;
SELECT `C1`,TRIM(`C1`) FROM `T11`;
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T12`;
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T12`;
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T12`;
SELECT `C1`,TRIM(`C1`) FROM `T12`;
DROP TABLE `T1`;
DROP TABLE `T2`;
DROP TABLE `T3`;
DROP TABLE `T4`;
DROP TABLE `T5`;
DROP TABLE `T6`;
DROP TABLE `T7`;
DROP TABLE `T8`;
DROP TABLE `T9`;
DROP TABLE `T10`;
DROP TABLE `T11`;
DROP TABLE `T12`;
|