Re: [sqlite] sqlite 3.20.1: Core dump when running query with json functions in subquery

2017-09-03 Thread Richard Hipp
A proposed fix for this problem is now on trunk. On 9/3/17, Richard Hipp wrote: > On 9/3/17, Martin Thierer wrote: >> I'm consistently getting a core dump for a query that has json >> functions in a subquery. The same functions work fine in other >>

Re: [sqlite] Example uses of the dbstat virtual table

2017-09-03 Thread Keith Medcalf
You need to have at least one of the arguments in floating point so the division operation is carried out in floating point The easiest way to do this is to use total() rather than sum(). sum() always returns an integer if all non-null inputs are integer. total() always returns a

Re: [sqlite] Example uses of the dbstat virtual table

2017-09-03 Thread Bart Smissaert
Both integer. RBS On Mon, Sep 4, 2017 at 12:50 AM, Simon Slavin wrote: > > > On 4 Sep 2017, at 12:00am, Bart Smissaert > wrote: > > > It looks this example doesn't work: > > > > SELECT sum(pgsize-unused)/sum(pgsize) FROM dbstat WHERE name='xyz'

Re: [sqlite] Example uses of the dbstat virtual table

2017-09-03 Thread Simon Slavin
On 4 Sep 2017, at 12:00am, Bart Smissaert wrote: > It looks this example doesn't work: > > SELECT sum(pgsize-unused)/sum(pgsize) FROM dbstat WHERE name='xyz' What is the output of SELECT typeof(pgsize), typeof(unused) FROM dbstat WHERE name='xyz' LIMIT 1 ? Simon.

Re: [sqlite] sqlite 3.20.1: Core dump when running query with json functions in subquery

2017-09-03 Thread Richard Hipp
On 9/3/17, Martin Thierer wrote: > 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. Thanks for the concise bug report. A ticket is here: https://sqlite.org/src/tktview/b899b6042f97f

[sqlite] Example uses of the dbstat virtual table

2017-09-03 Thread Bart Smissaert
It looks this example doesn't work: SELECT sum(pgsize-unused)/sum(pgsize) FROM dbstat WHERE name='xyz' I thinks it should be something like this: SELECT cast(sum(pgsize-unused) as real) / cast(sum(pgsize) as real) FROM dbstat WHERE name='xyz' RBS ___

[sqlite] sqlite 3.20.1: Core dump when running query with json functions in subquery

2017-09-03 Thread Martin Thierer
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

Re: [sqlite] SQLITE bug

2017-09-03 Thread R Smith
On 2017/09/03 4:16 PM, Joseph L. Casale wrote: -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of R Smith Sent: Sunday, September 3, 2017 7:51 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] SQLITE bug Lastly, a

Re: [sqlite] SQLITE bug

2017-09-03 Thread Richard Damon
On 9/3/17 10:16 AM, Joseph L. Casale wrote: -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of R Smith Sent: Sunday, September 3, 2017 7:51 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] SQLITE bug Lastly, a

Re: [sqlite] Amalgamation compilation with SQLITE_THREADSAFE=0

2017-09-03 Thread Rowan Worth
On 2 September 2017 at 22:19, Simon Slavin wrote: > > And please note that you never /need/ to do any kind of VACUUM in a > production setting. The only situation where it helps is if your database > is significantly shrinking and will not grow again soon, and that’s quite

Re: [sqlite] SQLITE bug

2017-09-03 Thread Joseph L. Casale
-Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of R Smith Sent: Sunday, September 3, 2017 7:51 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] SQLITE bug > Lastly, a comment I've made possibly more than once on this

Re: [sqlite] SQLITE bug

2017-09-03 Thread R Smith
I think this has been answered already in that it is not a bug, but I would like to mention why it works the way it works. Imagine you have some tables, like a list of clients (table: client) and a list of contacts which are foreign-keyed (or simply used in conjunction) with the client parent