Commit 02e35ef5 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)

parent ea1739f9
......@@ -10113,5 +10113,20 @@ DROP FUNCTION iswellformed;
DROP TABLE allbytes;
# End of ctype_backslash.inc
#
# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
#
SET NAMES utf8;
SELECT CHAR(0xDF USING latin1);
CHAR(0xDF USING latin1)
ß
CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select char(0xdf using latin1) AS `c` utf8 utf8_general_ci
SELECT * FROM v1;
c
ß
DROP VIEW v1;
#
# End of 10.0 tests
#
......@@ -4530,3 +4530,24 @@ latin2_general_ci
#
# End of 5.6 tests
#
#
# Start of 10.0 tests
#
#
# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
#
EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select char(0xdf using latin1) AS `CHAR(0xDF USING latin1)`
EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select char(0xdf) AS `CHAR(0xDF USING ``binary``)`
EXPLAIN EXTENDED SELECT CHAR(0xDF);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select char(0xdf) AS `CHAR(0xDF)`
......@@ -1868,6 +1868,18 @@ SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
let $ctype_unescape_combinations=selected;
--source include/ctype_unescape.inc
--echo #
--echo # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
--echo #
SET NAMES utf8;
SELECT CHAR(0xDF USING latin1);
CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;
--echo #
--echo # End of 10.0 tests
--echo #
......@@ -1742,3 +1742,15 @@ EXECUTE stmt;
--echo #
--echo # End of 5.6 tests
--echo #
--echo #
--echo # Start of 10.0 tests
--echo #
--echo #
--echo # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
--echo #
EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1);
EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`);
EXPLAIN EXTENDED SELECT CHAR(0xDF);
......@@ -2905,6 +2905,20 @@ String *Item_func_make_set::val_str(String *str)
}
void Item_func_char::print(String *str, enum_query_type query_type)
{
str->append(Item_func_char::func_name());
str->append('(');
print_args(str, 0, query_type);
if (collation.collation != &my_charset_bin)
{
str->append(C_STRING_WITH_LEN(" using "));
str->append(collation.collation->csname);
}
str->append(')');
}
String *Item_func_char::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
......
......@@ -702,6 +702,7 @@ class Item_func_char :public Item_str_func
max_length= arg_count * 4;
}
const char *func_name() const { return "char"; }
void print(String *str, enum_query_type query_type);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment