regression or bugfix? json_group_array over subquery double escapes quotes
(1) By Matt (iffycan2) on 2022-10-25 18:48:13 [link] [source]
I ran into what I think is a regression in upgrading from 3.35.0 to 3.39.4 but I guess it could be a bugfix depending on how you interpret the docs for json_group_array
. I didn't see any mention of json-related changes in the changelog, but I could have missed it.
This minimal example in 3.35.0 and 3.39.4 and produces different results:
create table foo (
a text,
b text
);
insert into foo (a,b) values ("a1", "b1"),("a2","b2");
select json_group_array(obj) from
(select
rowid as id,
json_object('a', a, 'b', b) AS obj
from foo);
Output in 3.35.0:
[{"a":"a1","b":"b1"},{"a":"a2","b":"b2"}]
Output in 3.39.4:
["{\"a\":\"a1\",\"b\":\"b1\"}","{\"a\":\"a2\",\"b\":\"b2\"}"]
Changing the final query column above to be json_group_array(json(obj))
produces the same output in both versions:
select json_group_array(json(obj)) from
(select
rowid as id,
json_object('a', a, 'b', b) AS obj
from foo);
(2) By Stephan Beal (stephan) on 2022-10-25 19:01:28 in reply to 1 [source]
... but I guess it could be a bugfix depending on how you interpret the docs for json_group_array.
That sounds like a37d3531d0d1665013007e61d.
(4) By Matt (iffycan2) on 2022-10-25 19:38:18 in reply to 2 [link] [source]
Yep, thank you!
(3) By Richard Hipp (drh) on 2022-10-25 19:04:28 in reply to 1 [link] [source]
This is a bug fix. The fix is at
Original bug report and discussion at: