1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-11571 JSON_EXTRACT returns wrong results.

Array counter didn't increment after an item was found.
This commit is contained in:
Alexey Botchkov
2016-12-24 10:51:43 +04:00
parent bbb3fb318e
commit 4d10273b4f
3 changed files with 5 additions and 4 deletions

View File

@ -1270,7 +1270,7 @@ int json_find_path(json_engine_t *je,
case JST_VALUE:
DBUG_ASSERT(cur_step->type & JSON_PATH_ARRAY);
if (cur_step->type & JSON_PATH_WILD ||
cur_step->n_item == array_counters[cur_step - p->steps])
cur_step->n_item == array_counters[cur_step - p->steps]++)
{
/* Array item matches. */
if (cur_step == p->last_step ||
@ -1278,10 +1278,7 @@ int json_find_path(json_engine_t *je,
goto exit;
}
else
{
json_skip_array_item(je);
array_counters[cur_step - p->steps]++;
}
break;
case JST_OBJ_END:
case JST_ARRAY_END: