1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-11572 JSON_DEPTH returns wrong results.

JSON depth calculation fixed.
This commit is contained in:
Alexey Botchkov
2016-12-16 14:06:12 +04:00
parent 30c231b03a
commit ce55094f4f
3 changed files with 5 additions and 0 deletions

View File

@ -405,6 +405,9 @@ json_depth('[[], {}]')
select json_depth('[[[1,2,3],"s"], {}, []]'); select json_depth('[[[1,2,3],"s"], {}, []]');
json_depth('[[[1,2,3],"s"], {}, []]') json_depth('[[[1,2,3],"s"], {}, []]')
4 4
select json_depth('[10, {"a": 20}]');
json_depth('[10, {"a": 20}]')
3
select json_length(''); select json_length('');
json_length('') json_length('')
NULL NULL

View File

@ -163,6 +163,7 @@ select cast(NULL AS JSON);
select json_depth(cast(NULL as JSON)); select json_depth(cast(NULL as JSON));
select json_depth('[[], {}]'); select json_depth('[[], {}]');
select json_depth('[[[1,2,3],"s"], {}, []]'); select json_depth('[[[1,2,3],"s"], {}, []]');
select json_depth('[10, {"a": 20}]');
select json_length(''); select json_length('');
select json_length('{}'); select json_length('{}');

View File

@ -1624,6 +1624,7 @@ longlong Item_func_json_depth::val_int()
switch (je.state) switch (je.state)
{ {
case JST_VALUE: case JST_VALUE:
case JST_KEY:
if (inc_depth) if (inc_depth)
{ {
c_depth++; c_depth++;