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

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