[MDEV-27346] JSON_TABLE() does not handle quoting of strings correctly Created: 2021-12-22 Updated: 2022-01-04 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.6.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Ryan Leadenham | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | JSON, JSON_TABLE | ||
| Environment: |
windows and linux |
||
| Issue Links: |
|
||||||||
| Description |
|
There is no way to quote a string with quotes in it correctly. Suppose you're working with the string: The book's title is "Lord of the Rings"
Results in a syntax error
Returns
Also returns I believe the previous one is most syntactically correct And even worse, this happens
Returns the `text` field as: (Yes, the trailing quote is missing) It seems like this is somewhat related to other JSON related bugs such as |
| Comments |
| Comment by Louis Brauer [ 2022-01-03 ] |
|
I have the same trouble with the `JSON_TABLE` function in *MariaDB 10.6.5*. This is my query: SET @data = '[ {"Data": "<root language=\\"de\\"></root>"}]'; SELECT 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 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 – correct: SELECT – correct: It looks to me that this difference in behaviour is a bug in MariaDB's side. |