summaryrefslogtreecommitdiff
path: root/mysql-test/main/ctype_cp1251.test
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2018-03-09 14:05:35 +0200
committerMonty <monty@mariadb.org>2018-03-29 13:59:44 +0300
commita7abddeffa6a760ce948c2dfb007cdf3f1a369d5 (patch)
tree70eb743fa965a17380bbc0ac88ae79ca1075b896 /mysql-test/main/ctype_cp1251.test
parentab1941266c59a19703a74b5593cf3f508a5752d7 (diff)
downloadmariadb-git-a7abddeffa6a760ce948c2dfb007cdf3f1a369d5.tar.gz
Create 'main' test directory and move 't' and 'r' there
Diffstat (limited to 'mysql-test/main/ctype_cp1251.test')
-rw-r--r--mysql-test/main/ctype_cp1251.test145
1 files changed, 145 insertions, 0 deletions
diff --git a/mysql-test/main/ctype_cp1251.test b/mysql-test/main/ctype_cp1251.test
new file mode 100644
index 00000000000..97978463407
--- /dev/null
+++ b/mysql-test/main/ctype_cp1251.test
@@ -0,0 +1,145 @@
+# 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
+--source include/ctype_pad_space.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 # MDEV-5459 Illegal mix of collations for datetime
+--echo #
+SET NAMES cp1251;
+CREATE TABLE t1 (dt DATETIME);
+INSERT INTO t1 VALUES ('2014-01-02 10:20:30');
+SELECT date(dt) FROM t1 WHERE (CASE WHEN 1 THEN date(dt) ELSE null END >= '2013-12-01 00:00:00');
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a IN (1,2,3);
+SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
+SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
+# Equality should not propagate ' 1' to IN: incompatible comparison context
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
+INSERT INTO t1 VALUES (' 1'),('`1');
+SELECT * FROM t1 WHERE a=' 1';
+SELECT * FROM t1 WHERE (a XOR '0');
+SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
+--echo # ' 1' should not be propagated into (a XIR '0')
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #