From ba5b2e7b291a9b4bfb97dcdf3c53ca49fc91a4e7 Mon Sep 17 00:00:00 2001 From: qggcs Date: Sat, 25 Jun 2022 22:03:08 +0800 Subject: [PATCH] json_type should consider the charset mbmaxlen --- mysql-test/suite/json/r/json_no_table.result | 2 +- sql/item_jsonfunc.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result index 6784fe6da32..10dd5d4b4ca 100644 --- a/mysql-test/suite/json/r/json_no_table.result +++ b/mysql-test/suite/json/r/json_no_table.result @@ -3338,7 +3338,7 @@ OBJECT CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT()); SELECT * FROM v1; JSON_TYPE(JSON_OBJECT()) -OBJE +OBJECT drop view v1; # # Bug#21198333 SIG 6 IN ITEM_CACHE_JSON::CACHE_VALUE AT SQL/ITEM.CC:9470 diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 89ac59098ac..f4ac1605ab6 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -2800,7 +2800,7 @@ longlong Item_func_json_depth::val_int() bool Item_func_json_type::fix_length_and_dec() { collation.set(&my_charset_utf8mb3_general_ci); - max_length= 12; + max_length= 12 * collation.collation->mbmaxlen; set_maybe_null(); return FALSE; }