Commit 80a38372 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-12877 Wrong result from JSON native function.

        JSON_QUOTE return type set to be JSON.
parent 825c8d79
...@@ -696,3 +696,6 @@ SET @path = "$.\"\\u00e4\""; ...@@ -696,3 +696,6 @@ SET @path = "$.\"\\u00e4\"";
select @str, @path, JSON_EXTRACT(@str, @path); select @str, @path, JSON_EXTRACT(@str, @path);
@str @path JSON_EXTRACT(@str, @path) @str @path JSON_EXTRACT(@str, @path)
{"\u00e4":"yes"} $."\u00e4" "yes" {"\u00e4":"yes"} $."\u00e4" "yes"
select json_array(5,json_query('[1,2]','$'));
json_array(5,json_query('[1,2]','$'))
[5, [1,2]]
...@@ -349,3 +349,8 @@ SET @str = "{\"\\u00e4\":\"yes\"}"; ...@@ -349,3 +349,8 @@ SET @str = "{\"\\u00e4\":\"yes\"}";
SET @path = "$.\"\\u00e4\""; SET @path = "$.\"\\u00e4\"";
select @str, @path, JSON_EXTRACT(@str, @path); select @str, @path, JSON_EXTRACT(@str, @path);
#
# MDEV-12877 Wrong result from JSON native function.
#
select json_array(5,json_query('[1,2]','$'));
...@@ -101,6 +101,7 @@ class Item_func_json_query: public Item_func_json_value ...@@ -101,6 +101,7 @@ class Item_func_json_query: public Item_func_json_value
public: public:
Item_func_json_query(THD *thd, Item *js, Item *i_path): Item_func_json_query(THD *thd, Item *js, Item *i_path):
Item_func_json_value(thd, js, i_path) {} Item_func_json_value(thd, js, i_path) {}
bool is_json_type() { return true; }
const char *func_name() const { return "json_query"; } const char *func_name() const { return "json_query"; }
bool check_and_get_value(json_engine_t *je, String *res, int *error); bool check_and_get_value(json_engine_t *je, String *res, int *error);
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
......
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