/ View Ticket
Only honor the register subtype value if the MEM_Subtype flag is set. Revised and improved fix for ticket [f45ac567eaa9f9]. (check-in: 1f4c667f user: drh tags: trunk)
14:54 Fixed ticket [f45ac567]: Invalid JSON generated by json_group_array() plus 7 other changes (artifact: 627a0c62 user: drh)
13:56 New ticket [f45ac567]. (artifact: 7ebe8f73 user: drh)

Ticket Hash: f45ac567eaa9f93c55eef59b33fb90f0146adf85
Title: Invalid JSON generated by json_group_array()
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2016-01-30 14:54:49
Version Found In: 3.10.2
User Comments:
drh added on 2016-01-30 13:56:13:

The first column in the output of the following query contains invalid JSON. The "abc" string value is not quoted. The output is [1,abc] instead of [1,"abc"]

INSERT INTO t1 VALUES(1),('abc');
  FROM t1;

This problem was reported by Marien Zwart on the SQLite Users mailing list.

drh added on 2016-01-30 14:54:49:

The underlying problem was that the subtype information for a VDBE register was not being cleared when that register was overwritten and reused, which cause cause the subtype from a prior json_object() call to leak into the parameter of the json_group_array() call. Upgraded the severity to Severe since this problem affects all users of sqlite3_value_subtype() and sqlite3_result_subtype().