Commit a75ac82c authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-9147: Character set is ignored in Dynamic Column for saved string

Fixed moving charset from definition to the value.
parent 98c9fbfa
......@@ -6,16 +6,16 @@ hex(COLUMN_CREATE(1, NULL AS char character set utf8))
000000
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8));
hex(COLUMN_CREATE(1, "afaf" AS char character set utf8))
0001000100030861666166
0001000100032161666166
select hex(COLUMN_CREATE(1, 1212 AS char character set utf8));
hex(COLUMN_CREATE(1, 1212 AS char character set utf8))
0001000100030831323132
0001000100032131323132
select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8));
hex(COLUMN_CREATE(1, 12.12 AS char character set utf8))
0001000100030831322E3132
0001000100032131322E3132
select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8));
hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8))
000100010003083939393939393939393939393939393939393939393939393939393939
000100010003213939393939393939393939393939393939393939393939393939393939
select hex(COLUMN_CREATE(1, NULL AS unsigned int));
hex(COLUMN_CREATE(1, NULL AS unsigned int))
000000
......@@ -144,7 +144,7 @@ hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
6, "2011-04-05" AS date,
7, "- 0:45:49.000001" AS time,
8, "2011-04-05 0:45:49.000001" AS datetime))
01080001000300020029000300380004004A0005008C000600AE000700C7000800F5000861666166BC0478093D0AD7A3703D284002028C0C85B60F010010B7000485B60F010010B70000
01080001000300020029000300380004004A0005008C000600AE000700C7000800F5002161666166BC0478093D0AD7A3703D284002028C0C85B60F010010B7000485B60F010010B70000
explain extended
select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
2, 1212 AS unsigned int,
......@@ -1848,5 +1848,15 @@ select column_json(column_create('float', 1.23456789012345E+10 as double));
column_json(column_create('float', 1.23456789012345E+10 as double))
{"float":12345678901.2345}
#
# MDEV-9147: Character set is ignored in Dynamic Column for saved string
#
SET NAMES utf8;
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CHAR CHARACTER SET utf8) AS a;
a
¢
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR CHARACTER SET utf8) AS a;
a
¢
#
# end of 10.0 tests
#
......@@ -901,6 +901,13 @@ select column_get(column_create('float', 1.23456789012345E+100 as double), 'floa
select column_json(column_create('float', 1.23456789012345E+100 as double));
select column_json(column_create('float', 1.23456789012345E+10 as double));
--echo #
--echo # MDEV-9147: Character set is ignored in Dynamic Column for saved string
--echo #
SET NAMES utf8;
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CHAR CHARACTER SET utf8) AS a;
SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR CHARACTER SET utf8) AS a;
--echo #
--echo # end of 10.0 tests
--echo #
......@@ -4448,6 +4448,8 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
case DYN_COL_DYNCOL:
case DYN_COL_STRING:
res= args[valpos]->val_str(&tmp);
if (res && defs[i].cs)
res->set_charset(defs[i].cs);
if (res &&
(vals[i].x.string.value.str= sql_strmake(res->ptr(), res->length())))
{
......
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