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:
@ -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
|
||||||
|
@ -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('{}');
|
||||||
|
@ -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++;
|
||||||
|
Reference in New Issue
Block a user