@@ -627,7 +627,7 @@ var JsonScripts = []ScriptTest{
627627 SetUpScript : []string {
628628 "create table t (pk int primary key, col1 JSON, col2 JSON);" ,
629629 `insert into t values (1, JSON_OBJECT('key1', 1, 'key2', '"abc"'), JSON_ARRAY(3,10,5,17,"z"));` ,
630- `insert into t values (2, JSON_OBJECT('key1', 100, 'key2', '" ghi" '), JSON_ARRAY(3,10,5,17,JSON_ARRAY(22,"y",66)));` ,
630+ `insert into t values (2, JSON_OBJECT('key1', 100, 'key2', 'ghi'), JSON_ARRAY(3,10,5,17,JSON_ARRAY(22,"y",66)));` ,
631631 `CREATE TABLE t2 (i INT PRIMARY KEY, j JSON);` ,
632632 `INSERT INTO t2 VALUES (0, '{"a": "123", "outer": {"inner": 456}}');` ,
633633 },
@@ -636,16 +636,23 @@ var JsonScripts = []ScriptTest{
636636 Query : `select col1->'$.key1' from t;` ,
637637 Expected : []sql.Row {{types .MustJSON ("1" )}, {types .MustJSON ("100" )}},
638638 },
639+ {
640+ Query : `select col1->'$.key2' from t;` ,
641+ Expected : []sql.Row {
642+ {types.JSONDocument {Val : "\" abc\" " }},
643+ {types.JSONDocument {Val : "ghi" }},
644+ },
645+ },
639646 {
640647 Query : `select col1->>'$.key2' from t;` ,
641- Expected : []sql.Row {{"abc" }, {"ghi" }},
648+ Expected : []sql.Row {{"\" abc\" " }, {"ghi" }},
642649 },
643650 {
644651 Query : `select pk, col1 from t where col1->'$.key1' = 1;` ,
645652 Expected : []sql.Row {{1 , types .MustJSON (`{"key1":1, "key2":"\"abc\""}` )}},
646653 },
647654 {
648- Query : `select pk, col1 from t where col1->>'$.key2' = 'abc';` ,
655+ Query : `select pk, col1 from t where col1->>'$.key2' = '" abc" ';` ,
649656 Expected : []sql.Row {{1 , types .MustJSON (`{"key1":1, "key2":"\"abc\""}` )}},
650657 },
651658 {
0 commit comments