Re: [sqlite] operation unexpectedly applied to both main and temp?

2017-03-28 Thread Hick Gunter
Ignore the first note. Table main.t is persistent, whrereas temp.t is automatically dropped on closing the connection. -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Hick Gunter Gesendet: Mittwoch, 29. März 2017 08:40 An:

Re: [sqlite] operation unexpectedly applied to both main and temp?

2017-03-28 Thread Hick Gunter
I find the .explain/explain functionality very helpful in clearing up what happens and why. Note the error when creating main.t. Note the database number 1 (for temp) vs. 0 (for main) in the OpenWrite and TableLock instructions. asql> create temp table t (db, val); asql> create table main.t (d

Re: [sqlite] VT table behavior change between 3.10 and 3.17

2017-03-28 Thread Hick Gunter
Can you provide an example of the bytecode produced? In the SQLite shell type: .explain explain ; Typical output (with SQLite version 3.7.14.1): asql> .explain asql> explain update mytable set myfield=2 where myconst=7; addr opcode p1p2p3p4 p5 comment ---

Re: [sqlite] operation unexpectedly applied to both main and temp?

2017-03-28 Thread Mark Brand
On 29/03/17 02:38, Simon Slavin wrote: On 29 Mar 2017, at 1:34am, Domingo Alvarez Duarte wrote: It seems sqlite look first if there is a temp.table before main.table and without qualification temp.table is used. You got it. It’s not obvious that this is what SQLite would do. But now you

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Simon Slavin
On 29 Mar 2017, at 1:34am, Domingo Alvarez Duarte wrote: > > It seems sqlite look first if there is a temp.table before main.table and > without qualification temp.table is used. You got it. It’s not obvious that this is what SQLite would do. But now you know it you understand what is happe

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Simon Slavin
On 29 Mar 2017, at 1:33am, Mark Brand wrote: >> The point isn't about which table one expects to receive the update, it's >> that *both* tables get updated. No. Just the one table is updated: the temp.t table. Both rows of data are in that table. Try repeating your experiment but replace t

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Domingo Alvarez Duarte
Hello ! I repeated your simple case and could see that only the temp.t tabale is populated/updates. It seems sqlite look first if there is a temp.table before main.table and without qualification temp.table is used. Cheers ! On 28/03/17 21:12, Mark Brand wrote: On 29/03/17 01:35, Simon

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Mark Brand
On 29/03/17 02:12, Mark Brand wrote: On 29/03/17 01:35, Simon Slavin wrote: On 28 Mar 2017, at 11:02pm, Mark Brand wrote: create temp table t (db, val); insert into t select 'temp', 'original'; create table t (db, val); insert into t select 'main', 'original'; Here’s your problem: SQLi

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Mark Brand
On 29/03/17 01:35, Simon Slavin wrote: On 28 Mar 2017, at 11:02pm, Mark Brand wrote: create temp table t (db, val); insert into t select 'temp', 'original'; create table t (db, val); insert into t select 'main', 'original'; Here’s your problem: SQLite version 3.16.0 2016-11-04 19:09:39 En

Re: [sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Simon Slavin
On 28 Mar 2017, at 11:02pm, Mark Brand wrote: > create temp table t (db, val); > insert into t select 'temp', 'original'; > > create table t (db, val); > insert into t select 'main', 'original'; Here’s your problem: SQLite version 3.16.0 2016-11-04 19:09:39 Enter ".help" for usage hints. sqli

[sqlite] BUG?: operation unexpectedly applied to both main and temp

2017-03-28 Thread Mark Brand
HI, Something seems to go wrong in this example where an operation unexpectedly gets applied both main and temp. The order of table creation seems to be one crucial factor. I ran into this while trying to get my head around the use of temporary triggers, which seems to be the other necessary

[sqlite] VT table behavior change between 3.10 and 3.17

2017-03-28 Thread Bob Friesenhahn
We are trying to update from sqlite3 3.10 to 3.17. Our virtual table modules are encountering problems with 3.17 since the 'xOpen' callback is now being called for value change and row deletion operations. Previously it was only being called for read-only queries. We are using reader/writer l

Re: [sqlite] Use of sqlite3_bind_int() vs sqlite3_bind_int64()

2017-03-28 Thread Paul
Thank you very much for replying so quickly! > On 3/28/17, Paul wrote: > > According to datatypes page https://sqlite.org/datatype3.html SQLite choses > > width of the integer automatically. Does it mean that if I let's say want to > > bind a number 5 in the query that inserts/updates rows it

Re: [sqlite] Use of sqlite3_bind_int() vs sqlite3_bind_int64()

2017-03-28 Thread Richard Hipp
On 3/28/17, Paul wrote: > According to datatypes page https://sqlite.org/datatype3.html SQLite choses > width of the integer automatically. Does it mean that if I let's say want to > bind a number 5 in the query that inserts/updates rows it will be stored in > database as 1-byte integer regardless

[sqlite] Use of sqlite3_bind_int() vs sqlite3_bind_int64()

2017-03-28 Thread Paul
According to datatypes page https://sqlite.org/datatype3.html SQLite choses width of the integer automatically. Does it mean that if I let's say want to bind a number 5 in the query that inserts/updates rows it will be stored in database as 1-byte integer regardless of the use of sqlite3_bind_in

Re: [sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Hick Gunter
You can always use CROSS JOIN to force a specific join order as in: SELECT ... FROM mytable m CROSS_JOIN split s ON (s.input = m.string_field) JOIN anothertable a ON (a.field = s.output) ... -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]

Re: [sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Paul Sanderson
I was a bit/very dull, schoolboy error :( re 32-bit - long week and it's only Tuesday :) Re: storing the length in the blob itself this would affect parsing the serial types where, as now, you can determine the record length by looking at the serial types and 'skip' through them to load a specific

Re: [sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Max Vlasov
On Tue, Mar 28, 2017 at 12:51 PM, Dominique Devienne wrote: > On Tue, Mar 28, 2017 at 11:00 AM, Hick Gunter wrote: > > > > > The "estimated cost" is described as "how many disk IO operations are > > expected". Version higher than 3.8.2 allow setting an "estimatedRows" > > (default: 25) and versi

Re: [sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Dominique Devienne
On Tue, Mar 28, 2017 at 12:52 PM, Paul Sanderson < sandersonforens...@gmail.com> wrote: > I am sure Richard will correct me if I am wrong. But... > > The format for a record is > > 1. payload length varint > 2. rowid varint (optional) > 3. serial type array varint > 4. serial types > followed by t

Re: [sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Paul Sanderson
I am sure Richard will correct me if I am wrong. But... The format for a record is 1. payload length varint 2. rowid varint (optional) 3. serial type array varint 4. serial types followed by the data for the serial types The issue are as I see them: The payload length varint above, this is the

Re: [sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Dominique Devienne
On Tue, Mar 28, 2017 at 11:08 AM, Richard Hipp wrote: > On 3/27/17, Andrew Cunningham wrote: > > Is it likely the maximum BLOB size will be increased in a not too distant > > future version of SQLite? > > The maximum blob size could, in theory, be increased to 4GiB. But the > current file forma

Re: [sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Dominique Devienne
On Tue, Mar 28, 2017 at 11:00 AM, Hick Gunter wrote: > >FWIW, I've often wondered about the cost estimates of real tables versus > virtual tables, especially since many vtables implementations don't involve > real IO but pure in-memory computations. There's >very little advice or > documentation

Re: [sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Richard Hipp
On 3/27/17, Andrew Cunningham wrote: > HI, > Is it likely the maximum BLOB size will be increased in a not too distant > future version of SQLite? > The maximum blob size could, in theory, be increased to 4GiB. But the current file format will not accommodate anything larger than that. -- D. R

Re: [sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Hick Gunter
>FWIW, I've often wondered about the cost estimates of real tables versus >virtual tables, especially since many vtables implementations don't involve >real IO but pure in-memory computations. There's >very little advice or >documentation on this important subject, and Max's email reveals that

[sqlite] BLOB sizes beyond 2GB?

2017-03-28 Thread Andrew Cunningham
HI, Is it likely the maximum BLOB size will be increased in a not too distant future version of SQLite? In a world of machines where 1TB memory is not unusual the current upper limit of ~2GB is proving to be restrictive for my use. One might suggest that storing binary data of that size using SQ

Re: [sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Dominique Devienne
On Tue, Mar 28, 2017 at 10:26 AM, Max Vlasov wrote: > I sometimes use virtual tables to implement some kind of one-to-many > output. One of examples mentioned previously was the comma list virtual > table when a field containing comma-separated values might be used to > output rows of values from

[sqlite] All versions compatible "very big" estimatedCost (Virtual tables)

2017-03-28 Thread Max Vlasov
Hi, I sometimes use virtual tables to implement some kind of one-to-many output. One of examples mentioned previously was the comma list virtual table when a field containing comma-separated values might be used to output rows of values from this list. Other example - performing regexp-like query

Re: [sqlite] Second beta for SQLite 3.18.0.

2017-03-28 Thread Clemens Ladisch
Daniel Polski wrote: > Can using "PRAGMA optimize" in one thread create a situation where > "BEGIN IMMEDIATE TRANSACTION" in another thread fails? While the optimization is done, the database is locked, just as with any other transaction that does writes. So any other thread has to use a timeout.

Re: [sqlite] Second beta for SQLite 3.18.0.

2017-03-28 Thread Daniel Polski
Den 2017-03-24 kl. 08:09, skrev Daniel Polski: The "PRAGMA optimize" looks interesting. - Can using "PRAGMA optimize" in one thread create a situation where "BEGIN IMMEDIATE TRANSACTION" in another thread fails? (The threads are using different connections) - Is there any risk of "optimizati