You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol
Item_func_dyncol_create::print_arguments() printed only CHARSET clause
without COLLATE.
Therefore,
HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin))
inside a VIEW changed to just:
HEX(column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3))
which changed the collation ID seen in the HEX output.
Note, the collation ID inside column_create() is not really much important.
(It's only important what the character set is).
And for COLLATE, the more important thing is what's later written
in the AS clause of COLUMN_GET:
SELECT
COLUMN_GET(
column_create(1,'1212' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)
column_nr AS type -- this type is more important
);
Still, let's add the COLLATE clause into the COLUMN_CREATE() print output,
although it's not important for now for anything else than just the HEX output.
At least to make VIEW work in a more predictable way with HEX(COLUMN_CREATE()).
Also, in the future we can start using somehow the collation ID written inside
COLUMN_CREATE(), for example by making the `AS type` clause optional in
COLUMN_GET():
COLUMN_GET(dyncol_blob, column_nr [AS type]);
instead of:
COLUMN_GET(dyncol_blob, column_nr AS type);
SQL Server compatibility layer may need this for
the SQL_Variant data type support.
Copy file name to clipboardExpand all lines: mysql-test/main/dyncol.result
+24-4Lines changed: 24 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -150,7 +150,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
150
150
id select_type table type possible_keys key key_len ref rows filtered Extra
151
151
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
152
152
Warnings:
153
-
Note 1003 select hex(column_create(1,'afaf' AS char charset utf8 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex`
153
+
Note 1003 select hex(column_create(1,'afaf' AS char charset utf8 collate utf8_general_ci ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex`
154
154
select hex(column_create(1, 0.0 AS decimal));
155
155
hex(column_create(1, 0.0 AS decimal))
156
156
000100010004
@@ -354,7 +354,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
354
354
id select_type table type possible_keys key key_len ref rows filtered Extra
355
355
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
356
356
Warnings:
357
-
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset utf8) AS `ex`
357
+
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 collate utf8_general_ci ),1 as char charset utf8) AS `ex`
358
358
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) as ex;
359
359
ex
360
360
1212
@@ -414,7 +414,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
414
414
id select_type table type possible_keys key key_len ref rows filtered Extra
415
415
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
416
416
Warnings:
417
-
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset binary) AS `ex`
417
+
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 collate utf8_general_ci ),1 as char charset binary) AS `ex`
418
418
#
419
419
# column get real
420
420
#
@@ -1882,7 +1882,7 @@ drop table t1;
1882
1882
create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char);
0 commit comments