I'm consistently getting a core dump for a query that has json
functions in a subquery. The same functions work fine in other
queries.

I came up with this small example which triggers the crash for me when
executed from the sqlite3 shell for a new, empty database:

CREATE TABLE dataset (
  doc TEXT
);
INSERT INTO dataset VALUES ('{"field1": [{"value": "val1"}, {"value":
"val2"}]');
INSERT INTO dataset VALUES ('{"field1": [{"value": "val3"}, {"value":
"val2"}]');
INSERT INTO dataset VALUES ('{"field1": [{"value": "val4"}, {"value":
"val1"}]');
SELECT * FROM dataset WHERE 'val1' IN
  (SELECT json_extract(json_each.value, '$.value')
    FROM json_each(json_extract(dataset.doc, '$.field')));

As I got syntax errors when copy-pasting even from my own email draft,
I also put it here:

https://gist.github.com/thierer/f4367232f58a452ff960fe61c3250fbe

This is with sqlite 3.20.1 on Arch Linux x86_64.

Thanks! (both for looking into this issue and sqlite in general...)

Martin
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to