1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-27412: JSON_TABLE doesn't properly unquote strings

Analysis:
The value gets appended as string instead of unescaped json value

Fix:
Append the value of json in a temporary string and then store it in the
field instead of directly storing as string.
This commit is contained in:
Rucha Deodhar
2024-07-23 16:09:10 +05:30
parent 6715e4dfe1
commit 753e7d6d7c
5 changed files with 28 additions and 2 deletions

View File

@ -1189,6 +1189,18 @@ SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_I
SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t;
DROP TABLE t;
--echo #
--echo # MDEV-27412: JSON_TABLE doesn't properly unquote strings
--echo #
SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]';
SELECT
data
FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;
--echo #
--echo # End of 10.6 tests
--echo #