I think you don't understand the bug.
Let me explain it more :
CREATE TABLE `test`.`test`( `test` TEXT );
|
INSERT INTO test (test) VALUES ('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }');
|
SELECT * FROM test ;
|
test
|
------------------------------------------------
|
{ "x": [0,1], "y": "[0,1]", "z": "Mon\"t\"y" }
|
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.
SELECT JSON_VALUE(@json,'$.z') FROM test;
|
JSON_VALUE(@json,'$.z')
|
-------------------------
|
Mon\"t\"y
|
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 :
TRUNCATE TABLE test;
|
INSERT INTO test (test) VALUES ('[0]');
|
UPDATE test SET test=JSON_ARRAY_APPEND(test, '$', "Mon\"t\"y")
|
SELECT "Mon\"t\"y", JSON_VALUE(test, '$[1]'), JSON_EXTRACT(test, '$[1]') FROM test
|
Mon"t"y JSON_VALUE(test, '$[1]') JSON_EXTRACT(test, '$[1]')
|
------- ------------------------ ----------------------------
|
Mon"t"y Mon\"t\"y "Mon\"t\"y"
|
As you can see I append to the array : Mon"t"y and when I query with JSON_VALUE I have : Mon\"t\"y
Still the escape is not wanted with JSON_VALUE
with JSON_EXTRACT, my software can do json_decode for example and will received the right value.
with JSON_VALUE, my software can't do json_decode since it's not a json value, and I don't have the right value
It works as expected. According to https://mariadb.com/kb/en/library/differences-between-json_query-and-json_value/
JSON_VALUE shoud return string literal from "Mon\\\"t\\\"y"
| Mon\"t\"y |
| Mon\"t\"y |
After rules about string literals https://mariadb.com/kb/en/library/string-literals/
"Mon\\\"t\\\"y" -> Mon\(\\)\"t\\\"y -> Mon\"(\")t\\\"y -> Mon\"t\(\\)\"y -> Mon\"t\"(\")y -> Mon\"t\"y