diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index a000cfbeefe90..1c1889f847d31 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1773,6 +1773,14 @@ null<=>json_extract('1',json_object(null,'{ }',null,null),'{}') 1 Warnings: Warning 4042 Syntax error in JSON path in argument 2 to function 'json_extract' at position 1 +SELECT JSON_EXTRACT('{a:true}','$.a')=TRUE; +JSON_EXTRACT('{a:true}','$.a')=TRUE +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 2 +SELECT JSON_EXTRACT('0E+0','$'); +JSON_EXTRACT('0E+0','$') +0E+0 # # End of 10.6 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index da22d719a8d3a..c3f6d2e551d82 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1239,6 +1239,10 @@ FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; select null<=>json_extract('1',json_object(null,'{ }',null,null),'{}'); + +SELECT JSON_EXTRACT('{a:true}','$.a')=TRUE; +SELECT JSON_EXTRACT('0E+0','$'); + --echo # --echo # End of 10.6 tests --echo # diff --git a/strings/json_lib.c b/strings/json_lib.c index 5f55a83c9d4f9..28c341ecf171a 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1701,14 +1701,14 @@ int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs, json_path_t *p) { json_scan_start(je, i_cs, str, end); - p->last_step= p->steps - 1; + p->last_step= NULL; return 0; } int json_get_path_next(json_engine_t *je, json_path_t *p) { - if (p->last_step < p->steps) + if (p->last_step == NULL) { if (json_read_value(je)) return 1;