Commit a8467e2f authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-11449 Server crashes in Item_func_or_sum::agg_item_collations.

        JSON_ARRAY didn't expect 0 arguments.
parent eca15790
......@@ -34,6 +34,9 @@ NULL
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
json_query('{"key1":123, "key1": [1,2,3]}', '$.key1')
[1,2,3]
select json_array();
json_array()
[]
select json_array(1);
json_array(1)
[1]
......@@ -150,6 +153,9 @@ json_remove(@j, '$.b')
select json_remove(@j, '$.a');
json_remove(@j, '$.a')
{"b": [2, 3]}
select json_object();
json_object()
{}
select json_object("ki", 1, "mi", "ya");
json_object("ki", 1, "mi", "ya")
{"ki": 1, "mi": "ya"}
......
......@@ -13,6 +13,7 @@ select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
select json_query('{"key1": 1}', '$.key1');
select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
select json_array();
select json_array(1);
select json_array(1, "text", false, null);
......@@ -63,6 +64,7 @@ set @j = '{"a": 1, "b": [2, 3]}';
select json_remove(@j, '$.b');
select json_remove(@j, '$.a');
select json_object();
select json_object("ki", 1, "mi", "ya");
select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
......
......@@ -877,6 +877,14 @@ void Item_func_json_array::fix_length_and_dec()
ulonglong char_length= 4;
uint n_arg;
if (arg_count == 0)
{
collation.set(&my_charset_utf8_general_ci);
tmp_val.set_charset(&my_charset_utf8_general_ci);
max_length= 2;
return;
}
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
return;
......
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