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{
202202 Name : "json conversion works with escaped characters" ,
203203 Assertions : []ScriptTestAssertion {
204204 {
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 );` ,
206206 Expected : []sql.Row {
207207 {`{"key\"with\"quotes": 1}` },
208208 },
209209 },
210210 },
211211 },
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+ },
212228 {
213229 Name : "json_value preserves types" ,
214230 Assertions : []ScriptTestAssertion {
You can’t perform that action at this time.
0 commit comments