Commit 3ea9d3e5 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-12363 Assertion `0' failed in...

MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*).

        maybe_null wasn't properly set for Item_json_func_keys.
parent 4a484e7a
......@@ -636,3 +636,9 @@ JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
bar
CREATE TABLE t1 (f INT NOT NULL);
INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;
......@@ -287,3 +287,12 @@ SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
#
# MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
#
CREATE TABLE t1 (f INT NOT NULL);
INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
DROP TABLE t1;
......@@ -444,6 +444,7 @@ void Item_func_json_value::fix_length_and_dec()
collation.set(args[0]->collation);
max_length= args[0]->max_length;
path.set_constant_flag(args[1]->const_item());
maybe_null= 1;
}
......@@ -582,6 +583,7 @@ void Item_func_json_unquote::fix_length_and_dec()
{
collation.set(&my_charset_utf8_general_ci);
max_length= args[0]->max_length;
maybe_null= 1;
}
......@@ -683,6 +685,7 @@ void Item_func_json_extract::fix_length_and_dec()
max_length= args[0]->max_length * (arg_count - 1);
mark_constant_paths(paths, args+1, arg_count-1);
maybe_null= 1;
}
......@@ -884,6 +887,7 @@ void Item_func_json_contains::fix_length_and_dec()
{
a2_constant= args[1]->const_item();
a2_parsed= FALSE;
maybe_null= 1;
if (arg_count > 2)
path.set_constant_flag(args[2]->const_item());
Item_int_func::fix_length_and_dec();
......@@ -1129,6 +1133,7 @@ void Item_func_json_contains_path::fix_length_and_dec()
{
ooa_constant= args[1]->const_item();
ooa_parsed= FALSE;
maybe_null= 1;
mark_constant_paths(paths, args+2, arg_count-2);
Item_int_func::fix_length_and_dec();
}
......@@ -2042,6 +2047,7 @@ void Item_func_json_length::fix_length_and_dec()
{
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
maybe_null= 1;
}
......@@ -2178,6 +2184,7 @@ void Item_func_json_type::fix_length_and_dec()
{
collation.set(&my_charset_utf8_general_ci);
max_length= 12;
maybe_null= 1;
}
......@@ -2245,6 +2252,7 @@ void Item_func_json_insert::fix_length_and_dec()
}
fix_char_length_ulonglong(char_length);
maybe_null= 1;
}
......@@ -2491,6 +2499,7 @@ void Item_func_json_remove::fix_length_and_dec()
max_length= args[0]->max_length;
mark_constant_paths(paths, args+1, arg_count-1);
maybe_null= 1;
}
......@@ -2674,6 +2683,7 @@ void Item_func_json_keys::fix_length_and_dec()
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
maybe_null= 1;
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
}
......@@ -2815,6 +2825,7 @@ void Item_func_json_search::fix_length_and_dec()
if (arg_count > 4)
mark_constant_paths(paths, args+4, arg_count-4);
maybe_null= 1;
}
......@@ -2996,6 +3007,7 @@ void Item_func_json_format::fix_length_and_dec()
{
decimals= 0;
max_length= args[0]->max_length;
maybe_null= 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