summaryrefslogtreecommitdiff
path: root/mysql-test/t/ctype_cp1251.test
blob: ab260f0c7e8dab7e1b0ed93bd09b9dca7e082813 (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
# Test of charset cp1251

--disable_warnings
drop table if exists t1;
--enable_warnings

SET NAMES cp1251;

#
# Test problem with LEFT() (Bug #514)
#

create table t1 (a varchar(10) not null) character set cp1251;
insert into t1 values ("a"),("ab"),("abc");
select * from t1;
select a, left(a,1) as b from t1;
select a, left(a,1) as b from t1 group by a;
SELECT DISTINCT RIGHT(a,1) from t1;
drop table t1;

#
# Test of binary and upper/lower
#
create table t1 (a char(3) binary, b binary(3)) character set cp1251;
insert into t1 values ('aaa','bbb'),('AAA','BBB');
select upper(a),upper(b) from t1;
select lower(a),lower(b) from t1;
select * from t1 where upper(a)='AAA';
select * from t1 where lower(a)='aaa';
select * from t1 where upper(b)='BBB';
select * from t1 where lower(b)='bbb';
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
drop table t1;

# Test for BUG#8560
create table t1 (
 a varchar(16) character set cp1251 collate cp1251_bin not null,
 b int(10) default null,
 primary key(a)
) charset=cp1251;
insert into t1 (a) values ('air'),
  ('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
  ('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
  ('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');

--sorted_result
select * from t1 where a like 'we_%';
drop table t1;

#
# Bug#158 ENUM and SET types does not accept valid cp1251 character
#
CREATE TABLE t1 (
  e1 enum('ябълка'),
  e2 enum('мляко')
) ENGINE=MYISAM character set cp1251;
SHOW CREATE TABLE t1;
DROP TABLE t1;

# End of 4.1 tests

--echo #
--echo # Start of 5.1 tests
--echo #

--source include/ctype_8bit.inc

#
# Bug #48053 String::c_ptr has a race and/or does an invalid 
#            memory reference
#            (triggered by Valgrind tests)
#  (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
#
--error 1649
set global LC_TIME_NAMES=convert((-8388608) using cp1251);


--echo #
--echo # End of 5.1 tests
--echo #

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

--source include/ctype_numconv.inc

--echo #
--echo # Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
--echo #
CREATE TABLE t1 (test1 INT, test2 VARCHAR(255));
SHOW CREATE TABLE t1;
SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1;
SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
DROP TABLE t1;


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