summaryrefslogtreecommitdiff
path: root/mysql-test/r/ctype_utf8.result
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-07-19 09:55:19 +0400
committerAlexander Barkov <bar@mariadb.com>2018-07-19 09:55:51 +0400
commitab58493db22d870cb6a470d6b0551cfc70dd09f3 (patch)
tree3f9394115673ae87a2dbfdf3e8ea0428a8dbddb5 /mysql-test/r/ctype_utf8.result
parentada54101a7185782657813c553907f61f2a35faf (diff)
downloadmariadb-git-ab58493db22d870cb6a470d6b0551cfc70dd09f3.tar.gz
MDEV-13118 Wrong results with LOWER and UPPER and subquery
This problem is similar to MDEV-10306. 1. Fixing Item_str_conv::val_str(String *str) to return the result in "str", and to use tmp_value only as a temporary buffer for args[0]->val_str(). The new code version now guarantees that the result is always returned in "str". The trick with copy_if_not_alloced() is not used any more. 2. The change #1 revealed the same problem in SUBSTRING_INDEX(), so some tests with combinations of UPPER()/LOWER() and SUBSTRING_INDEX() started to fail. Fixing Item_func_substr_index::val_str() the same way, to return the result in "str" and use tmp_value as a temporary buffer for args[0]->val_str().
Diffstat (limited to 'mysql-test/r/ctype_utf8.result')
-rw-r--r--mysql-test/r/ctype_utf8.result23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 7a3ff3732c3..6a4001597c4 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -10127,6 +10127,29 @@ SELECT * FROM v1;
c
ß
DROP VIEW v1;
+SET NAMES utf8;
+#
+# MDEV-13118 Wrong results with LOWER and UPPER and subquery
+#
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch=_latin1'derived_merge=on';
+CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `t` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+c2
+abcdefghi-abcdefghi
+abcdefghi-abcdefghi
+SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+c2
+ABCDEFGHI-ABCDEFGHI
+ABCDEFGHI-ABCDEFGHI
+DROP TABLE t1;
+SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#