mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-32287: JSON_EXTRACT not returning multiple values for same path
Analysis: When scanning json and getting the exact path at each step, if a path is reached, we end up adding the item in the result and immediately get the next item which results in current path changing. Fix: Instead of immediately returning the item, count the occurences of the path in argument and append in the result as needed.
This commit is contained in:
@ -1690,6 +1690,12 @@ select json_arrayagg('ä'), json_objectagg(1, 'ä');
|
||||
json_arrayagg('ä') json_objectagg(1, 'ä')
|
||||
["ä"] {"1":"ä"}
|
||||
#
|
||||
# MDEV-32287: JSON_EXTRACT not returning multiple values for same path
|
||||
#
|
||||
select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]');
|
||||
JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]')
|
||||
[40, 40]
|
||||
#
|
||||
# MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json
|
||||
#
|
||||
CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL));
|
||||
|
Reference in New Issue
Block a user