Re: [sqlite] Quick way to figure SQLite database block size per table & indexes

2018-07-30 Thread David Yip
Hi Eric, If you have the dbstat module enabled (-DSQLITE_ENABLE_DBSTAT_VTAB), you can query the dbstat virtual table for the number of pages used per table and index, e.g. SELECT name, COUNT(path) AS pages FROM dbstat GROUP BY name ORDER BY pages DESC; This runs in ~600 ms on one of my

Re: [sqlite] Bad implementation in mem5.c memsys5Roundup method in the latest version 3.25.0

2018-08-09 Thread David Yip
Do you have a benchmark demonstrating that time taken in memsys5Roundup is a bottleneck on some compiler and platform? gcc and clang both turn for(iFullSz=mem5.szAtom; iFullSz wrote: > We can increase the efficiency with the following code replace: > > > > > static int memsys5Roundup(int

[sqlite] Out-of-bounds read in FTS5 on 3.24.0 and 201807110327 snapshot

2018-07-24 Thread David Yip
Hi all, On x86-64 Linux with SQLite 3.24.0 and the 201807110327 SQLite snapshot, the following program causes FTS5 to do an out-of-bounds access: https://gitlab.peach-bun.com/snippets/157 Sample ASan and Valgrind outputs are here: https://gitlab.peach-bun.com/snippets/158 It looks like if you

Re: [sqlite] Out-of-bounds read in FTS5 on 3.24.0 and 201807110327 snapshot

2018-07-25 Thread David Yip
Thank you for the quick fix! On Wed, Jul 25, 2018 at 10:27 AM, Dan Kennedy wrote: > On 07/25/2018 10:50 AM, David Yip wrote: > >> Hi all, >> >> On x86-64 Linux with SQLite 3.24.0 and the 201807110327 SQLite snapshot, >> the >> following program cause

Re: [sqlite] union + window functions = sqlite crash (version 3.25.2)

2018-10-23 Thread David Yip
I dug a little more into this with a debug build; was able to get the same crash trace with the slightly smaller query CREATE TABLE t(a); SELECT 1, 1 UNION ALL SELECT a, RANK() OVER (ORDER BY a) FROM t; which fails the pTab!=0 assertion in sqlite3ColumnsFromExprList. It seems

Re: [sqlite] nested foreign keys

2018-10-24 Thread David Yip
Roman Fleysher < roman.fleys...@einstein.yu.edu> wrote: > The statements work. Insertion fails. > > Roman > > > From: sqlite-users [sqlite-users-boun...@mailinglists.sqlite.org] on > behalf of David Yip [dw...@peach-bun.com] > Se

Re: [sqlite] nested foreign keys

2018-10-24 Thread David Yip
These statements worked for me: CREATE TABLE grandparent (id INTEGER PRIMARY KEY); CREATE TABLE parent (id INTEGER PRIMARY KEY REFERENCES grandparent(id)); CREATE TABLE child (id INTEGER PRIMARY KEY REFERENCES parent(id)); The foreign key constraints work as you'd expect also. What are you