Details
Description
I have trouble with the `JSON_TABLE` function in *MariaDB 10.6.5*. This is my query:
SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; |
|
SELECT
|
data
|
FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;}} |
What I get back is the XML string, but not properly unescaped:
<root language=\"de\"></root> |
When I use then `JSON_VALUE` instead:
SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; |
|
SELECT
|
JSON_VALUE(@DATA, '$[0].Data'); |
then I get back the correctly unescaped string:
<root language="de"></root> |
When I do the same on a MySQL *8.0.26* server, it works as expected:
SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; |
|
SELECT
|
data
|
FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; |
|
-- correct:
|
-- <root language="de"></root>
|
|
SELECT
|
JSON_VALUE(@data, '$[0].Data'); |
|
-- correct:
|
-- <root language="de"></root> |
It looks to me that this difference in behaviour is a bug in MariaDB's side.
Attachments
Issue Links
- relates to
-
MDEV-27346 JSON_TABLE() does not handle quoting of strings correctly
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
I have trouble with the `JSON_TABLE` function in **MariaDB 10.6.5**. This is my query:
{{SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; }} What I get back is the XML string, but not properly unescaped: {{<root language=\"de\"></root>}} When I use then `JSON_VALUE` instead: {{SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT JSON_VALUE(@DATA, '$[0].Data');}} then I get back the correctly unescaped string: {{<root language="de"></root>}} When I do the same on a MySQL **8.0.26** server, it works as expected: {{ SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; -- correct: -- <root language="de"></root> SELECT JSON_VALUE(@data, '$[0].Data'); -- correct: -- <root language="de"></root> }} It looks to me that this difference in behaviour is a bug in MariaDB's side. |
I have trouble with the `JSON_TABLE` function in **MariaDB 10.6.5**. This is my query:
{code:sql} SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;}} {code} What I get back is the XML string, but not properly unescaped: {{<root language=\"de\"></root>}} When I use then `JSON_VALUE` instead: {{SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT JSON_VALUE(@DATA, '$[0].Data');}} then I get back the correctly unescaped string: {{<root language="de"></root>}} When I do the same on a MySQL **8.0.26** server, it works as expected: {{ SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; -- correct: -- <root language="de"></root> SELECT JSON_VALUE(@data, '$[0].Data'); -- correct: -- <root language="de"></root> }} It looks to me that this difference in behaviour is a bug in MariaDB's side. |
Description |
I have trouble with the `JSON_TABLE` function in **MariaDB 10.6.5**. This is my query:
{code:sql} SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;}} {code} What I get back is the XML string, but not properly unescaped: {{<root language=\"de\"></root>}} When I use then `JSON_VALUE` instead: {{SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT JSON_VALUE(@DATA, '$[0].Data');}} then I get back the correctly unescaped string: {{<root language="de"></root>}} When I do the same on a MySQL **8.0.26** server, it works as expected: {{ SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; -- correct: -- <root language="de"></root> SELECT JSON_VALUE(@data, '$[0].Data'); -- correct: -- <root language="de"></root> }} It looks to me that this difference in behaviour is a bug in MariaDB's side. |
I have trouble with the `JSON_TABLE` function in **MariaDB 10.6.5**. This is my query:
{code:sql} SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;}} {code} What I get back is the XML string, but not properly unescaped: {code:xml} <root language=\"de\"></root> {code} When I use then `JSON_VALUE` instead: {code:sql} SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT JSON_VALUE(@DATA, '$[0].Data'); {code} then I get back the correctly unescaped string: {code:xml} <root language="de"></root> {code} When I do the same on a MySQL **8.0.26** server, it works as expected: {code:sql} SET @data = '[{"Data": "<root language=\\"de\\"></root>"}]'; SELECT data FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; -- correct: -- <root language="de"></root> SELECT JSON_VALUE(@data, '$[0].Data'); -- correct: -- <root language="de"></root> {code} It looks to me that this difference in behaviour is a bug in MariaDB's side. |
Link | This issue relates to MDEV-27346 [ MDEV-27346 ] |
Assignee | Oleksandr Byelkin [ sanja ] |
Assignee | Oleksandr Byelkin [ sanja ] | Rucha Deodhar [ rucha174 ] |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.7 [ 24805 ] |
Fix Version/s | 10.7 [ 24805 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Priority | Critical [ 2 ] | Major [ 3 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Rucha Deodhar [ rucha174 ] | Alexey Botchkov [ holyfoot ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Alexey Botchkov [ holyfoot ] | Rucha Deodhar [ rucha174 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.6.20 [ 29903 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Fix Version/s | 10.11.10 [ 29904 ] | |
Fix Version/s | 11.2.6 [ 29906 ] | |
Fix Version/s | 11.4.4 [ 29907 ] |
This issue is a show stopper for our project at the moment. I hope it gets addressed soon.