Commit ce55094f authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-11572 JSON_DEPTH returns wrong results.

        JSON depth calculation fixed.
parent 30c231b0
......@@ -405,6 +405,9 @@ json_depth('[[], {}]')
select json_depth('[[[1,2,3],"s"], {}, []]');
json_depth('[[[1,2,3],"s"], {}, []]')
4
select json_depth('[10, {"a": 20}]');
json_depth('[10, {"a": 20}]')
3
select json_length('');
json_length('')
NULL
......
......@@ -163,6 +163,7 @@ select cast(NULL AS JSON);
select json_depth(cast(NULL as JSON));
select json_depth('[[], {}]');
select json_depth('[[[1,2,3],"s"], {}, []]');
select json_depth('[10, {"a": 20}]');
select json_length('');
select json_length('{}');
......
......@@ -1624,6 +1624,7 @@ longlong Item_func_json_depth::val_int()
switch (je.state)
{
case JST_VALUE:
case JST_KEY:
if (inc_depth)
{
c_depth++;
......
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