View Ticket
Not logged in
Ticket UUID: 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().