File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -202,13 +202,29 @@ var JsonScripts = []ScriptTest{
202
202
Name : "json conversion works with escaped characters" ,
203
203
Assertions : []ScriptTestAssertion {
204
204
{
205
- Query : `select cast(cast (JSON_OBJECT('key"with"quotes', 1) as char ) as json );` ,
205
+ Query : `SELECT CAST(CAST (JSON_OBJECT('key"with"quotes', 1) as CHAR ) as JSON );` ,
206
206
Expected : []sql.Row {
207
207
{`{"key\"with\"quotes": 1}` },
208
208
},
209
209
},
210
210
},
211
211
},
212
+ {
213
+ Name : "json_object with escaped k:v pairs from table" ,
214
+ SetUpScript : []string {
215
+ `CREATE TABLE textt (t text);` ,
216
+ `INSERT INTO textt VALUES ('first row\n\\'), ('second row"');` ,
217
+ },
218
+ Assertions : []ScriptTestAssertion {
219
+ {
220
+ Query : `SELECT JSON_OBJECT(t, t) FROM textt;` ,
221
+ Expected : []sql.Row {
222
+ {types .MustJSON (`{"first row\n\\": "first row\n\\"}` )},
223
+ {types .MustJSON (`{"second row\"": "second row\""}` )},
224
+ },
225
+ },
226
+ },
227
+ },
212
228
{
213
229
Name : "json_value preserves types" ,
214
230
Assertions : []ScriptTestAssertion {
You can’t perform that action at this time.
0 commit comments