mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-27151: JSON_VALUE() does not parse NULL properties properly
Analysis: JSON_VALUE() returns "null" string instead of NULL pointer. Fix: When the type is JSON_VALUE_NULL (which is also a scalar) set null_value to true and return 0 instead of returning string.
This commit is contained in:
@ -619,6 +619,12 @@ continue_search:
|
||||
if (json_read_value(&je))
|
||||
goto err_return;
|
||||
|
||||
if (je.value_type == JSON_VALUE_NULL)
|
||||
{
|
||||
null_value= 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (unlikely(check_and_get_value(&je, str, &error)))
|
||||
{
|
||||
if (error)
|
||||
@ -1111,7 +1117,6 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
|
||||
case JSON_VALUE_OBJECT:
|
||||
case JSON_VALUE_ARRAY:
|
||||
case JSON_VALUE_FALSE:
|
||||
// TODO: fix: NULL should be NULL
|
||||
case JSON_VALUE_NULL:
|
||||
int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
|
||||
return to;
|
||||
|
Reference in New Issue
Block a user