diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2017-09-12 19:15:31 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2017-09-12 19:15:31 +0400 |
commit | 80a38372832b391488a09c71a260334b23e5c98e (patch) | |
tree | e33cf0c64019eec164db00935ec98bcc942f25b2 | |
parent | 825c8d793d6828bdb4d38ae6dea53ba1363852cf (diff) | |
download | mariadb-git-80a38372832b391488a09c71a260334b23e5c98e.tar.gz |
MDEV-12877 Wrong result from JSON native function.
JSON_QUOTE return type set to be JSON.
-rw-r--r-- | mysql-test/r/func_json.result | 3 | ||||
-rw-r--r-- | mysql-test/t/func_json.test | 5 | ||||
-rw-r--r-- | sql/item_jsonfunc.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 5aca3c21936..0c60c42ec77 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -696,3 +696,6 @@ SET @path = "$.\"\\u00e4\""; select @str, @path, JSON_EXTRACT(@str, @path); @str @path JSON_EXTRACT(@str, @path) {"\u00e4":"yes"} $."\u00e4" "yes" +select json_array(5,json_query('[1,2]','$')); +json_array(5,json_query('[1,2]','$')) +[5, [1,2]] diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index f561a2cda8f..39e31b8bb58 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -349,3 +349,8 @@ SET @str = "{\"\\u00e4\":\"yes\"}"; SET @path = "$.\"\\u00e4\""; select @str, @path, JSON_EXTRACT(@str, @path); +# +# MDEV-12877 Wrong result from JSON native function. +# +select json_array(5,json_query('[1,2]','$')); + diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index b5c35ff551f..927b60015b8 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -101,6 +101,7 @@ class Item_func_json_query: public Item_func_json_value public: Item_func_json_query(THD *thd, Item *js, Item *i_path): Item_func_json_value(thd, js, i_path) {} + bool is_json_type() { return true; } const char *func_name() const { return "json_query"; } bool check_and_get_value(json_engine_t *je, String *res, int *error); Item *get_copy(THD *thd, MEM_ROOT *mem_root) |