mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / ctype_many.test
blob84048761228ea5319c5ba12d8b144e24aead3b93
1 -- source include/have_ucs2.inc
3 --disable_warnings
4 DROP TABLE IF EXISTS t1;
5 --enable_warnings
7 SET CHARACTER SET latin1;
9 CREATE TABLE t1 (
10   comment CHAR(32) ASCII NOT NULL,
11   koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default ''
12 ) CHARSET=latin5;
14 SHOW CREATE TABLE t1;
15 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
16 SHOW CREATE TABLE t1;
17 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
18 SHOW CREATE TABLE t1;
19 ALTER TABLE t1 DEFAULT CHARSET=latin2;
20 ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
21 SHOW CREATE TABLE t1;
22 ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
23 SHOW CREATE TABLE t1;
25 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
26 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
27 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
28 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
29 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
30 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
31 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
32 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
33 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
34 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
35 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
36 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
37 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
38 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
39 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
40 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
41 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
42 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
43 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
44 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
45 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
46 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
47 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
48 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
49 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
50 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
51 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
52 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
53 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
54 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
55 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
56 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
57 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
58 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
59 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
60 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
61 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
62 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
63 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
64 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
65 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
66 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
67 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
68 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
69 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
70 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
71 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
72 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
73 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
74 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
75 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
76 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
77 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Á','CYR SMALL A');
78 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Â','CYR SMALL BE');
79 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'×','CYR SMALL VE');
80 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ç','CYR SMALL GE');
81 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ä','CYR SMALL DE');
82 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Å','CYR SMALL IE');
83 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'£','CYR SMALL IO');
84 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ö','CYR SMALL ZHE');
85 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ú','CYR SMALL ZE');
86 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'É','CYR SMALL I');
87 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ë','CYR SMALL KA');
88 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ì','CYR SMALL EL');
89 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Í','CYR SMALL EM');
90 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Î','CYR SMALL EN');
91 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ï','CYR SMALL O');
92 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ð','CYR SMALL PE');
93 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ò','CYR SMALL ER');
94 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ó','CYR SMALL ES');
95 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ô','CYR SMALL TE');
96 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Õ','CYR SMALL U');
97 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Æ','CYR SMALL EF');
98 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'È','CYR SMALL HA');
99 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ã','CYR SMALL TSE');
100 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Þ','CYR SMALL CHE');
101 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Û','CYR SMALL SHA');
102 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ý','CYR SMALL SCHA');
103 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ß','CYR SMALL HARD SIGN');
104 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ù','CYR SMALL YERU');
105 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ø','CYR SMALL SOFT SIGN');
106 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ü','CYR SMALL E');
107 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'À','CYR SMALL YU');
108 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'Ñ','CYR SMALL YA');
109 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'á','CYR CAPIT A');
110 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'â','CYR CAPIT BE');
111 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'÷','CYR CAPIT VE');
112 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ç','CYR CAPIT GE');
113 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ä','CYR CAPIT DE');
114 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'å','CYR CAPIT IE');
115 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'³','CYR CAPIT IO');
116 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ö','CYR CAPIT ZHE');
117 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ú','CYR CAPIT ZE');
118 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'é','CYR CAPIT I');
119 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ë','CYR CAPIT KA');
120 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ì','CYR CAPIT EL');
121 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'í','CYR CAPIT EM');
122 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'î','CYR CAPIT EN');
123 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ï','CYR CAPIT O');
124 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ð','CYR CAPIT PE');
125 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ò','CYR CAPIT ER');
126 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ó','CYR CAPIT ES');
127 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ô','CYR CAPIT TE');
128 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'õ','CYR CAPIT U');
129 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'æ','CYR CAPIT EF');
130 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'è','CYR CAPIT HA');
131 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ã','CYR CAPIT TSE');
132 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'þ','CYR CAPIT CHE');
133 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'û','CYR CAPIT SHA');
134 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ý','CYR CAPIT SCHA');
135 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ÿ','CYR CAPIT HARD SIGN');
136 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ù','CYR CAPIT YERU');
137 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ø','CYR CAPIT SOFT SIGN');
138 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ü','CYR CAPIT E');
139 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'à','CYR CAPIT YU');
140 INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ñ','CYR CAPIT YA');
142 SET CHARACTER SET utf8;
143 SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
145 ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL default '';
146 UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
147 SET CHARACTER SET koi8r;
148 SELECT * FROM t1;
151 ALTER TABLE t1 ADD bin_f CHAR(1) BYTE NOT NULL default '';
152 UPDATE t1 SET bin_f=koi8_ru_f;
153 SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
155 SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
156 SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
157 SELECT DISTINCT koi8_ru_f FROM t1;
158 SELECT DISTINCT utf8_f FROM t1;
159 SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
160 SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
162 SELECT t11.comment,t12.comment 
163 FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
164 ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
166 SELECT t11.comment,t12.comment 
167 FROM t1 t11,t1 t12 
168 WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
169 ORDER BY t12.utf8_f,t11.comment,t12.comment;
171 SET CHARACTER SET utf8;
172 ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
174 --disable_warnings
175 ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
176 --enable_warnings
178 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
179 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
180 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
181 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
182 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
183 INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
184 INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
185 INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
186 INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
187 INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
188 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
189 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
190 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
191 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
192 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
193 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
194 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
195 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
196 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
197 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
198 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
199 INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
201 ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
202 ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
203 UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE%';
204 UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%';
205 UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
206 UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
207 SELECT comment, koi8_ru_f, utf8_f, hex(bin_f), ucs2_f, armscii8_f, greek_f FROM t1;
208 SET CHARACTER SET 'binary';
209 SELECT * FROM t1;
210 SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
211 DROP TABLE t1;
213 # End of 4.1 tests
216 --echo #
217 --echo # Start of 5.1 tests
218 --echo #
220 --echo #
221 --echo # Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
222 --echo #
224 SET NAMES latin1;
225 DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) 
226                 AS BINARY(0)) USING utf8);
227 --echo #
228 --echo # End of 5.1 tests
229 --echo #