Yes, that old version (from about 2 years ago) crashes (on Windows).  
No, the current one does not crash and produces two output lines.  

This is using your test SQL with the spelling errors fixed.

CREATE TABLE mimmo (key TEXT PRIMARY KEY, value TEXT, valueJson TEXT, blockNo 
INTEGER, txnNo INTEGER, metadata TEXT);
INSERT INTO mimmo (key, valueJson) VALUES ('key2', 
'{"peppo":[["a","b"],["c","d"]]}');
SELECT s.key FROM mimmo AS s, json_each(json_extract(s.valueJson, '$.peppo')) 
AS a WHERE (SELECT COUNT(*) FROM json_each(a.value)) > 0;

SQLite version 3.30.0 2019-07-23 21:48:21
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE mimmo (key TEXT PRIMARY KEY, value TEXT, valueJson TEXT, 
blockNo INTEGER, txnNo INTEGER, metadata TEXT);
sqlite> INSERT INTO mimmo (key, valueJson) VALUES ('key2', 
'{"peppo":[["a","b"],["c","d"]]}');
sqlite> SELECT s.key FROM mimmo AS s, json_each(json_extract(s.valueJson, 
'$.peppo')) AS a WHERE (SELECT COUNT(*) FROM json_each(a.value)) > 0;
key2
key2

bisect complete
  1 GOOD    2018-01-27 18:55:18 6ea8ba312c38365d
  4 GOOD    2018-01-26 22:41:59 7daa687340e47597
  7 BAD     2018-01-26 18:59:25 029ebcd30cb261d9 CURRENT
  6 BAD     2018-01-26 18:37:34 ace0644a1a2a42a3
  5 BAD     2018-01-25 20:50:46 30b9258294e3028e
  3 BAD     2018-01-24 18:28:39 090a64faaac579c6
  2 BAD     2018-01-23 20:22:15 b58b60b2c0729b73

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Charles Leifer
>Sent: Tuesday, 23 July, 2019 20:08
>To: SQLite mailing list
>Subject: Re: [sqlite] Seg fault using json_each() subquery
>
>Partial traceback (bdb 18.1.32):
>
>Program received signal SIGSEGV, Segmentation fault.
>0x00007ffff798e560 in jsonEachColumn () from ./lib/libdb_sql-18.1.so
>(gdb) bt full
>#0  0x00007ffff798e560 in jsonEachColumn () from ./lib/libdb_sql-
>18.1.so
>No symbol table info available.
>#1  0x00007ffff79b29b6 in sqlite3VdbeExec () from ./lib/libdb_sql-
>18.1.so
>No symbol table info available.
>
>Unfortunately this is next-to-useless, but may provide a clue?
>
>On Tue, Jul 23, 2019 at 11:04 AM Carlo Innocenti
><mino...@minollo.com>
>wrote:
>
>> I'm using sqlite with BDB as the persistence store; if you can't
>> reproduce it (same sqlite version), I suppose it means it's a
>BerkeleyDB
>> issue, and I'll follow up with them.
>> Thanks!
>>
>> On 7/23/2019 12:01, Richard Hipp wrote:
>> > Unable to reproduce.  Are you sure you are sending the correct
>script?
>> >   What operating system are you running on?  How did you compile
>> > SQLite?
>> >
>> > On 7/23/19, Carlo Innocenti <mino...@minollo.com> wrote:
>> >> I have a segmentation fault which happens when trying to run a
>subquery
>> >> based on json_each() if the argument is the value of an outer
>> >> json_each() row:
>> >>
>> >>      CREATE TABLE mimmo (key TEXT PRIMARY KEY, value TEXT,
>valueJson
>> >>      TEXT, blockNo INTEGER, txnNo INTEGER, metadata TEXT);
>> >>      INSER INTO mimmo (key, valueJson) VALUES ('key2',
>> > Did you mean to say "INSERT" here, instead of "INSER"?
>> >
>> >>      '{"peppo":[["a","b"],["c","d"]]}');
>> >>      SELECT s.key FROM mimmo AS s,
>json_each(json_extract(s.valueJson,
>> >>      '$.peppo')) AS a WHERE (SELECT COUNT(*) FROM
>json_each(a.value)) >
>> 0;
>> >>
>> >> sqlite> select sqlite_version();
>> >> 3.18.2
>> >>
>> >> Am I doing anything obviously wrong? Or is this a known
>> problem/limitation?
>> >> Thanks!
>> >> Minollo
>> >>
>> >> _______________________________________________
>> >> sqlite-users mailing list
>> >> sqlite-users@mailinglists.sqlite.org
>> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
>users
>> >>
>> >
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
>users
>>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to