mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-29212: json_overlaps() does not check nested key-value pair correctly
Analysis: JSON_OVERLAPS() does not check nested key-value pair completely. If there is nested object, then it only scans and validates if two json values overlap until one of the value (which is of type object) is exhausted. This does not really check if the two values of keys are exacly the same, instead it only checks if key-value pair of one is present in key-value pair of the other Fix: Normalize the values (which are of type object) and compare using string compare. This will validate if two values are exactly the same.
This commit is contained in:
@ -1533,6 +1533,15 @@ SELECT JSON_EXISTS(@json, '$[2][2][1 to 4]');
|
||||
|
||||
SELECT * FROM JSON_TABLE('{"foo":["bar","qux"]}','$**.*[0]' COLUMNS(col1 CHAR(8) PATH '$[0]')) AS jt;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29212: json_overlaps() does not check nested key-value pair correctly
|
||||
--echo #
|
||||
|
||||
SET @json1 = '{"kk":{"k1":"v1","k2":"v2"}}';
|
||||
SET @json2 = '{"kk":{"k1":"v1","k2":"v2","k3":"v3"}}';
|
||||
SELECT JSON_OVERLAPS(@json2, @json1);
|
||||
SELECT JSON_OVERLAPS(@json1, @json2);
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.9 Test
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user