summaryrefslogtreecommitdiff
path: root/mysql-test/main/ctype_latin2_ch.test
blob: 06ccd2c9782844c7d469d39765653ee84096a599 (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
-- source include/have_latin2_ch.inc

#
# Tests with latin2_czech_cs
#
--disable_warnings
drop table if exists t1;
--enable_warnings

#
# Bug#17374: select ... like 'A%' operator fails
# to find value on columuns with key
#
set names latin2;
select 'A' = 'a' collate latin2_czech_cs;
create table t1 (
    id  int(5) not null,    
    tt  char(255) not null
) character set latin2 collate latin2_czech_cs;
insert into t1 values (1,'Aa');
insert into t1 values (2,'Aas');
alter table t1 add primary key aaa(tt); 
select * from t1 where tt like 'Aa%';
select * from t1 ignore index (primary) where tt like 'Aa%';
select * from t1 where tt like '%Aa%';
select * from t1 where tt like 'AA%';
select * from t1 ignore index (primary) where tt like 'AA%';
select * from t1 where tt like '%AA%';

drop table t1;

# End of 4.1 tests

set names latin2 collate latin2_czech_cs;
--source include/ctype_pad_space.inc
--source include/ctype_like_cond_propagation.inc

# We can not use ctype_filesort.inc because
# order of SPACE and TAB is not strict
#--source include/ctype_filesort.inc
#

#
# Bug#29459 server died handling latin2 collate latin2_czech_cs
#
create table t1 (
  a varchar(2) character set latin2 collate latin2_czech_cs,
  primary key(a)
);
insert into t1 set a=0x5ff;
insert into t1 set a=0xff;
select hex(a) from t1;
drop table t1;

#
# Bug#33452 Primary difference between capital and small letters U and O
#
create table t1 (
  ch varchar(1),
  name varchar(64)
) character set latin2 collate latin2_czech_cs;

insert into t1 values (0x6F,'LATIN SMALL LETTER O');
insert into t1 values (0xF3,'LATIN SMALL LETTER O WITH ACUTE');
insert into t1 values (0xF4,'LATIN SMALL LETTER O WITH CIRCUMFLEX');
insert into t1 values (0xF6,'LATIN SMALL LETTER O WITH DIAERESIS');
insert into t1 values (0xF5,'LATIN SMALL LETTER O WITH DOUBLE ACUTE');
insert into t1 values (0x4F,'LATIN CAPITAL LETTER O');
insert into t1 values (0xD3,'LATIN CAPITAL LETTER O WITH ACUTE');
insert into t1 values (0xD4,'LATIN CAPITAL LETTER O WITH CURCUMFLEX');
insert into t1 values (0xD6,'LATIN CAPITAL LETTER O WITH DIAERESIS');
insert into t1 values (0xD5,'LATIN CAPITAL LETTER O WITH DOUBLE ACUTE');

insert into t1 values (0x75,'LATIN SMALL LETTER U');
insert into t1 values (0xFA,'LATIN SMALL LETTER U WITH ACUTE');
insert into t1 values (0xF9,'LATIN SMALL LETTER U WITH RING ABOVE');
insert into t1 values (0xFC,'LATIN SMALL LETTER U WITH DIAERESIS');
insert into t1 values (0xFB,'LATIN SMALL LETTER U WITH DOUBLE ACUTE');
insert into t1 values (0x55,'LATIN CAPITAL LETTER U');
insert into t1 values (0xDA,'LATIN CAPITAL LETTER U WITH ACUTE');
insert into t1 values (0xD9,'LATIN CAPITAL LETTER U WITH RING ABOVE');
insert into t1 values (0xDC,'LATIN CAPITAL LETTER U WITH DIAERESIS');
insert into t1 values (0xDB,'LATIN CAPITAL LETTER U WITH DOUBLE ACUTE');
select
hex(weight_string(ch level 1)) l1,
hex(weight_string(ch level 2)) l2,
hex(weight_string(ch level 3)) l3,
hex(weight_string(ch level 4)) l4,
name from t1 order by binary l1, binary l2, binary l3, binary l4;
drop table t1;

#
# Bug#33791 Wrong ORDER BY with latin2_czech_cs
#
set names utf8;
create table t1 (
ch varchar(1),
name varchar(64)
) character set latin2 collate latin2_czech_cs;
insert into t1 values (0x4F,'LATIN CAPITAL LETTER O');
insert into t1 values (0xD3,'LATIN CAPITAL LETTER O WITH ACUTE');
insert into t1 values (0xD4,'LATIN CAPITAL LETTER O WITH CURCUMFLEX');
insert into t1 values (0xD6,'LATIN CAPITAL LETTER O WITH DIAERESIS');
insert into t1 values (0xD5,'LATIN CAPITAL LETTER O WITH DOUBLE ACUTE');
insert into t1 values (0x75,'LATIN _SMALL_ LETTER U');
insert into t1 values (0xFA,'LATIN _SMALL_ LETTER U WITH ACUTE');
insert into t1 values (0xF9,'LATIN _SMALL_ LETTER U WITH RING ABOVE');
insert into t1 values (0xFC,'LATIN _SMALL_ LETTER U WITH DIAERESIS');
insert into t1 values (0xFB,'LATIN _SMALL_ LETTER U WITH DOUBLE ACUTE');
# Testing order by Field_varchar
select ch,
  hex(weight_string(ch level 1)) l1,
  hex(weight_string(ch level 2)) l2,
  hex(weight_string(ch level 3)) l3,
  hex(weight_string(ch level 4)) l4,
  name from t1 order by ch;
alter table t1 modify ch char(1), modify name char(64);
# Testing order by Field_char
select ch,
  hex(weight_string(ch level 1)) l1,
  hex(weight_string(ch level 2)) l2,
  hex(weight_string(ch level 3)) l3,
  hex(weight_string(ch level 4)) l4,
  name from t1 order by ch;
# Testing order by Item
select ch,
  hex(weight_string(ch level 1)) l1,
  hex(weight_string(ch level 2)) l2,
  hex(weight_string(ch level 3)) l3,
  hex(weight_string(ch level 4)) l4,
  name from t1 order by concat(ch);
drop table t1;

#
# Bug #30462 Character sets: search failures with case sensitive collations
#
SET collation_connection=latin2_czech_cs;
CREATE TABLE t1 ENGINE=MYISAM AS SELECT repeat('a', 5) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
CREATE INDEX i1 ON t1 (s1);
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;

set sql_mode="";
--disable_warnings
CREATE TABLE t1 ENGINE=INNODB AS SELECT repeat('a', 5) AS s1 LIMIT 0;
--enable_warnings
INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
CREATE INDEX i1 ON t1 (s1);
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;

--disable_warnings
SET sql_mode='';
CREATE TABLE t1 ENGINE=FALCON AS SELECT repeat('a', 5) AS s1 LIMIT 0;
SET sql_mode=DEFAULT;
--enable_warnings
INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
CREATE INDEX i1 ON t1 (s1);
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;

--disable_warnings
SET sql_mode='';
CREATE TABLE t1 ENGINE=MARIA AS SELECT repeat('a', 5) AS s1 LIMIT 0;
SET sql_mode=DEFAULT;
--enable_warnings
INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
CREATE INDEX i1 ON t1 (s1);
SELECT * FROM t1 GROUP BY s1;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;

SET NAMES latin2;


#
# Bug#37854 Test fails/aborts for collate latin2_czech_cs used with SET and ENUM datatypes
#
CREATE TABLE t2(colours SET('red','blue','yellow'))CHARACTER SET latin2 COLLATE
latin2_czech_cs;
CREATE TABLE t1(continent ENUM('Asia', 'Europe','Africa','Antartica'))CHARACTER SET latin2
COLLATE latin2_czech_cs;
INSERT INTO t1 VALUES('Asia');
INSERT INTO t2 VALUES('blue');
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1, t2;

#
# Bug#40805 Cannot restore table
#
CREATE TABLE `t1` (
  `ID` smallint(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `Post` enum('','B','O','Z','U') COLLATE latin2_czech_cs DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=135 DEFAULT CHARSET=latin2;
SHOW CREATE TABLE t1;
INSERT INTO t1 (ID,Post) VALUES (00041,'');
SELECT ID, Post, HEX(WEIGHT_STRING(Post)) FROM t1;
DROP TABLE t1;


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

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

set names latin2 collate latin2_czech_cs;
--source include/ctype_pad_space.inc
# We can not use ctype_filesort.inc because
# order of SPACE and TAB is not strict
#--source include/ctype_filesort.inc

--echo #
--echo # Note:
--echo # latin2_czech_cs does not support WEIGHT_STRING in full extent
--echo #
--source include/weight_string.inc
--source include/weight_string_chde.inc
--source include/weight_string_l1.inc
--source include/weight_string_l2.inc
--source include/weight_string_l3.inc
--source include/weight_string_l4.inc
--source include/weight_string_l12.inc
--source include/weight_string_l14.inc

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