diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result index 6466b1a2dc2..7c311c23033 100644 --- a/mysql-test/r/func_json.result +++ b/mysql-test/r/func_json.result @@ -176,6 +176,9 @@ NULL select json_contains_path('{ "a": true }', 'all', NULL ); json_contains_path('{ "a": true }', 'all', NULL ) NULL +select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*'); +json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*') +1 select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1"); json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1") "asd" diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test index 8e36a3ed18b..f7cc6f99f73 100644 --- a/mysql-test/t/func_json.test +++ b/mysql-test/t/func_json.test @@ -65,6 +65,7 @@ select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma"); select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2"); select json_contains_path('{ "a": true }', NULL, '$.a' ); select json_contains_path('{ "a": true }', 'all', NULL ); +select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*'); select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1"); select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY"); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 9535feb0d8e..fc3f772321a 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -1032,8 +1032,8 @@ longlong Item_func_json_contains_path::val_int() { String *s_p= args[n_arg]->val_str(tmp_paths+(n_arg-2)); if (s_p && - path_setup_nwc(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), - (const uchar *) s_p->ptr() + s_p->length())) + json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(), + (const uchar *) s_p->ptr() + s_p->length())) { report_path_error(s_p, &c_path->p, n_arg-2); goto return_null;