Commit a2ce788f authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25259 JSON_TABLE: Illegal mix of collations upon executing query with...

MDEV-25259 JSON_TABLE: Illegal mix of collations upon executing query with combination of charsets via view.

The ::print method didn't print the explicitly specified charset.
parent 67b31a6e
...@@ -793,5 +793,15 @@ a b c o ...@@ -793,5 +793,15 @@ a b c o
DROP VIEW v2; DROP VIEW v2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# MDEV-25259 JSON_TABLE: Illegal mix of collations upon executing query with combination of charsets via view.
#
CREATE VIEW v AS
SELECT * FROM JSON_TABLE(CONVERT('[]' USING dec8),
'$' COLUMNS(b VARCHAR(8) CHARSET utf8 PATH '$')) AS jt2
WHERE (CONVERT('[]' USING cp1256) = b);
SELECT * FROM v;
b
DROP VIEW v;
#
# End of 10.6 tests # End of 10.6 tests
# #
...@@ -685,6 +685,19 @@ FROM ...@@ -685,6 +685,19 @@ FROM
DROP VIEW v2; DROP VIEW v2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # MDEV-25259 JSON_TABLE: Illegal mix of collations upon executing query with combination of charsets via view.
--echo #
CREATE VIEW v AS
SELECT * FROM JSON_TABLE(CONVERT('[]' USING dec8),
'$' COLUMNS(b VARCHAR(8) CHARSET utf8 PATH '$')) AS jt2
WHERE (CONVERT('[]' USING cp1256) = b);
SELECT * FROM v;
DROP VIEW v;
--echo # --echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo # --echo #
...@@ -1098,6 +1098,8 @@ int Json_table_column::print(THD *thd, Field **f, String *str) ...@@ -1098,6 +1098,8 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
(*f)->sql_type(column_type); (*f)->sql_type(column_type);
if (str->append(column_type) || if (str->append(column_type) ||
(m_explicit_cs &&
(str->append(" CHARSET ") || str->append(m_explicit_cs->csname))) ||
str->append(m_column_type == PATH ? " PATH " : " EXISTS PATH ") || str->append(m_column_type == PATH ? " PATH " : " EXISTS PATH ") ||
print_path(str, &m_path)) print_path(str, &m_path))
return 1; return 1;
......
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