[MDEV-14402] JSON_VALUE doesn't escape quote Created: 2017-11-15 Updated: 2017-11-16 Resolved: 2017-11-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.2.10 |
| Fix Version/s: | 10.2.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lu Do | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Using official mariadb docker image |
||
| Description |
|
Based on official example :
return :
as you can see Mon\"t\"y is not escape as it must be |
| Comments |
| Comment by Alice Sherepa [ 2017-11-16 ] | |||||||||||||||||
|
It works as expected. According to https://mariadb.com/kb/en/library/differences-between-json_query-and-json_value/
After rules about string literals https://mariadb.com/kb/en/library/string-literals/
| |||||||||||||||||
| Comment by Lu Do [ 2017-11-16 ] | |||||||||||||||||
|
I think you don't understand the bug.
As you can see the \" \" is escape needed by Json to be a valid json. But when I extract a value the escaped is not needed and must be remove to have the valid string.
In my case, I insert a value Mon"t"y and I expect to extract the same value not an escape one Mon\"t\"y Another example :
As you can see I append to the array : Mon"t"y and when I query with JSON_VALUE I have : Mon\"t\"y with JSON_EXTRACT, my software can do json_decode for example and will received the right value. | |||||||||||||||||
| Comment by Alice Sherepa [ 2017-11-16 ] | |||||||||||||||||
|
yes, I admit I was wrong, JSON_VALUE should probably return Mon"t"y | |||||||||||||||||
| Comment by Alexey Botchkov [ 2017-11-16 ] | |||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2017-November/011666.html |