mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-11449 Server crashes in Item_func_or_sum::agg_item_collations.
JSON_ARRAY didn't expect 0 arguments.
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user