[MDEV-16462] EXPLAIN FORMAT=JSON produces illegal JSON text Created: 2018-06-11 Updated: 2023-04-27 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Admin statements, JSON, Optimizer |
| Affects Version/s: | 10.1, 10.2.15, 10.2, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Peter-Jan Roes | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
EXPLAIN FORMAT=JSON can produce JSON with illegal content, that is, JSON that cannot be parsed correctly. This happens when some BLOB value ends up in an "attached_condition" for a "duplicate_removal". The bytes of the BLOB seem to be inserted directly into the JSON string without any conversion to text. I would expect some proper conversion to, for instance, hexadecimal notation or Base64. Chances are high that the bytes of the BLOB will not be proper Unicode characters in the selected character encoding (UTF-8 in my case) and therefore a proper JSON parser will reject the JSON value. This behavior can be reproduced using the following script:
This should produce something like:
Please note the line:
The resulting JSON has been copied from the mysql command client and seems to have already been processed for illegal characters in some way. The underlying client/server protocol does return the bytes of the BLOB as is. |
| Comments |
| Comment by Elena Stepanova [ 2018-07-17 ] |
|
Thanks for the report. Reproducible as described, although I don't know what it is meant to produce instead, leaving it to psergey to decide. |