diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 464f15af14e..c87a2998724 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1243,6 +1243,9 @@ drop view v; select json_arrayagg(a order by a asc) from (select 1 a union select 2 a) t; json_arrayagg(a order by a asc) [1,2] +select json_object('x', json_arrayagg(json_object('a', 1))); +json_object('x', json_arrayagg(json_object('a', 1))) +{"x": [{"a": 1}]} # # End of 10.5 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index a0b65218978..d22b41027b4 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -761,6 +761,8 @@ drop view v; select json_arrayagg(a order by a asc) from (select 1 a union select 2 a) t; +select json_object('x', json_arrayagg(json_object('a', 1))); + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql/item.h b/sql/item.h index deb398299fc..c6e1bd19a22 100644 --- a/sql/item.h +++ b/sql/item.h @@ -5325,6 +5325,7 @@ public: { return ref ? (*ref)->get_typelib() : NULL; } + bool is_json_type() { return (*ref)->is_json_type(); } bool walk(Item_processor processor, bool walk_subquery, void *arg) {