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

2017-03-30 Thread Mark Brand
On 30/03/17 21:06, David Raymond wrote: Close. It rests on the backs of 4 elephants, who in turn stand on the back of the Great A'Tuin I don't know but I've been told it's turtles all the way down. ___ sqlite-users mailing list

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

2017-03-30 Thread David Raymond
Close. It rests on the backs of 4 elephants, who in turn stand on the back of the Great A'Tuin "Of course, temp itself is attached to a elephant standing on a stack of turtles. Mark" ___ sqlite-users mailing list

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

2017-03-30 Thread Mark Brand
On 30/03/17 19:10, Simon Slavin wrote: On 30 Mar 2017, at 5:53pm, Mark Brand wrote: The documentation actually says "*least* recently attached". https://www.sqlite.org/lang_attach.html, paragraph 4. I’m unsure whether you can legitimately say that the "temp" database

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

2017-03-30 Thread Simon Slavin
On 30 Mar 2017, at 5:53pm, Mark Brand wrote: > The documentation actually says "*least* recently attached". > https://www.sqlite.org/lang_attach.html, paragraph 4. I’m unsure whether you can legitimately say that the "temp" database is attached to "main". But whatever

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

2017-03-30 Thread Mark Brand
On 29/03/17 15:29, Olivier Mascia wrote: Le 29 mars 2017 à 02:38, Simon Slavin a écrit : 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

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

2017-03-29 Thread Olivier Mascia
Le 29 mars 2017 à 02:38, Simon Slavin a écrit : >> 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

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

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

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,

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';

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

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"

[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