summaryrefslogtreecommitdiff
path: root/mysql-test/main/ctype_utf32_uca.test
blob: dd60feaf8e2eec7e2afa306da8297d5385ee1bc8 (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
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
-- source include/have_ucs2.inc
-- source include/have_utf32.inc

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

--echo #
--echo # Start of 5.5 tests
--echo #
--disable_service_connection

set names utf8;
set collation_connection=utf32_unicode_ci;
select hex('a'), hex('a ');
-- source include/endspace.inc

#
# Bug #6787 LIKE not working properly with _ and utf8 data
#
select 'c' like '\_' as want0; 

#
# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
#
CREATE TABLE t (
  c char(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARACTER SET utf32 COLLATE=utf32_unicode_ci;
INSERT INTO t VALUES ('a'),('ab'),('aba');
ALTER TABLE t ADD INDEX (c);
SELECT c FROM t WHERE c LIKE 'a%';
DROP TABLE t;


create table t1 (c1 char(10) character set utf32 collate utf32_bin);

--source include/ctype_unicode_latin.inc

select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_icelandic_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_latvian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_romanian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovenian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_polish_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_estonian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_swedish_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_turkish_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_czech_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_danish_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_lithuanian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovak_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish2_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_roman_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_esperanto_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_hungarian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_croatian_mysql561_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_croatian_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_german2_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_520_ci;
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_vietnamese_ci;

drop table t1;

#
# Bug#5324
#
SET NAMES utf8;
#test1
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL, INDEX (c));
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
#Check one row
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_general_ci;
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
#Check two rows
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
COLLATE utf32_general_ci ORDER BY c;
DROP TABLE t1;
#test2
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
#Check one row
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_unicode_ci;
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
#Check two rows
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
COLLATE utf32_unicode_ci ORDER BY c;
DROP TABLE t1;
#test 3
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
#Check one row row
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32) COLLATE utf32_unicode_ci;
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
#Check two rows
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32)
COLLATE utf32_unicode_ci ORDER BY c;
DROP TABLE t1;


SET NAMES utf8;
SET @test_character_set='utf32';
SET @test_collation='utf32_swedish_ci';
-- source include/ctype_common.inc


SET collation_connection='utf32_unicode_ci';
-- source include/ctype_filesort.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_german.inc

--echo End of 4.1 tests

#
# Check UPPER/LOWER changing length
#
# Result shorter than argument
CREATE TABLE t1 (id int, a varchar(30) character set utf32);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf32 collate utf32_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
DROP TABLE t1;

#
# Bug #27079 Crash while grouping empty ucs2 strings
#
CREATE TABLE t1 (
 c1 text character set utf32 collate utf32_polish_ci NOT NULL
) ENGINE=MyISAM;
insert into t1 values (''),('a');
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
DROP TABLE IF EXISTS t1;


#
# Test basic regex functionality
#
set collation_connection=utf32_unicode_ci;
--source include/ctype_regex.inc


#
# Test like_range and contractions
#
SET collation_connection=utf32_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc

--echo #
--echo # Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN 
--echo #   MY_UCA_CHARCMP WITH UTF32
--echo #

SET collation_connection=utf32_unicode_ci;
CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
INSERT INTO t1 VALUES ('a'), ('b');
CREATE TABLE t2 (b VARBINARY(5) NOT NULL);

--echo #insert chars outside of BMP
INSERT INTO t2 VALUEs (0x082837),(0x082837);

--echo #test for read-out-of-bounds with non-BMP chars as a LIKE pattern
SELECT * FROM t1,t2 WHERE a LIKE b;

--echo #test the original statement
SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;

DROP TABLE t1,t2;

--echo #
--echo # End of 5.5 tests
--echo #


--echo #
--echo # Start of 5.6 tests
--echo #

--echo #
--echo # WL#3664 WEIGHT_STRING
--echo #

set collation_connection=utf32_unicode_ci;
--source include/weight_string.inc
--source include/weight_string_euro.inc
select hex(weight_string(_utf32 0x10000 collate utf32_unicode_ci));
select hex(weight_string(_utf32 0x10001 collate utf32_unicode_ci));
--source include/weight_string_l1.inc

set @@collation_connection=utf32_czech_ci;
--source include/weight_string_chde.inc

#
# WL#4013 Unicode german2 collation
#
SET NAMES utf8;
SET collation_connection=utf32_german2_ci;
--source include/ctype_german.inc

--echo #
--echo # WL#2673 Unicode Collation Algorithm new version
--echo #
SET NAMES utf8mb4;
SET collation_connection=utf32_unicode_520_ci;
--source include/ctype_unicode520.inc

--echo #
--echo # End of 5.6 tests
--echo #


--echo #
--echo # Start of MariaDB-10.0 tests
--echo #
--echo

--echo #
--echo # MDEV-4929 Myanmar collation
--echo #
SET NAMES utf8;
SET collation_connection=utf32_myanmar_ci;
--source include/ctype_myanmar.inc

--echo #
--echo # End of MariaDB-10.0 tests
--echo #

--echo #
--echo # Start of 10.1 tests
--echo #

SET NAMES utf8;
SET collation_connection=utf32_thai_520_w2;
--source include/ctype_uca_w2.inc
--source include/ctype_thai.inc

--echo #
--echo # End of 10.1 tests
--echo #


--echo #
--echo # Start of 10.2 tests
--echo #

--echo #
--echo # MDEV-10877 xxx_unicode_nopad_ci collations
--echo #
SET NAMES utf8, character_set_connection=utf32;
let $coll='utf32_unicode_nopad_ci';
let $coll_pad='utf32_unicode_ci';
--source include/ctype_pad_all_engines.inc

let $coll='utf32_unicode_520_nopad_ci';
let $coll_pad='utf32_unicode_520_ci';
--source include/ctype_pad_all_engines.inc

SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;


--echo #
--echo # MDEV-25402 Assertion `!str || str != Ptr' failed in String::copy
--echo #

SET @c:="SET SESSION collation_connection=utf32_spanish_ci";
PREPARE s FROM @c;
EXECUTE s;
CREATE PROCEDURE p (IN i INT) EXECUTE s;
SET SESSION character_set_connection=latin1;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
CALL p (@a);
DEALLOCATE PREPARE s;
DROP PROCEDURE p;

SET NAMES utf8;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
SET collation_connection=utf32_spanish_ci;
EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;

--echo #
--echo # MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
--echo #

CREATE TABLE t1 (a CHAR(1));
SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary;
--error ER_DUPLICATED_VALUE_IN_TYPE
ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET NAMES utf8;

--enable_service_connection

--echo #
--echo # End of 10.2 tests
--echo #


--echo #
--echo # Start of 10.4 tests
--echo #

--echo #
--echo # MDEV-22499 Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed in TABLE_SHARE::init_from_binary_frm_image
--echo #

SET @@SESSION.collation_connection=utf32_estonian_ci;
CREATE TABLE t1(c1 SET('a') COLLATE 'Binary',c2 JSON);
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET NAMES utf8;

--echo #
--echo # End of 10.4 tests
--echo #


--echo #
--echo # Start of 10.9 tests
--echo #

--echo #
--echo # MDEV-27009 Add UCA-14.0.0 collations
--echo # Collation IDs in the protocol
--echo #

SET @charset='utf32';
--source include/ctype_uca1400_ids_using_convert.inc

--echo #
--echo # End of 10.9 tests
--echo #