Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Hick Gunter
. -Ursprüngliche Nachricht- Von: dave [mailto:d...@ziggurat29.com] Gesendet: Sonntag, 26. Oktober 2014 00:36 An: 'General Discussion of SQLite Database'; sqlite-...@sqlite.org Betreff: Re: [sqlite] quasi-bug related to locking, and attached databases -Original Message- From: sqlite

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 9:23 AM, Hick Gunter h...@scigames.at wrote: SQLite treats each attached database as a separate entity. Attaching the same file twice is just asking for problems. The query specifies that the destination db be locked for write and the source db for read; which

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Simon Slavin
On 27 Oct 2014, at 8:43am, Stephan Beal sgb...@googlemail.com wrote: - a couple months back Simon suggested ATTACHing the db to itself so that we can effectively alias main to the well-known name we have specified for that db instance. It worked like a charm until Dave discovered this weird

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 9:58 AM, Simon Slavin slav...@bigfraud.org wrote: On 27 Oct 2014, at 8:43am, Stephan Beal sgb...@googlemail.com wrote: - a couple months back Simon suggested ATTACHing the db to itself so that we can effectively alias main to the well-known name we have specified

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Hick Gunter
An: General Discussion of SQLite Database Betreff: Re: [sqlite] quasi-bug related to locking, and attached databases On Mon, Oct 27, 2014 at 9:23 AM, Hick Gunter h...@scigames.at wrote: SQLite treats each attached database as a separate entity. Attaching the same file twice is just asking

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 10:44 AM, Hick Gunter h...@scigames.at wrote: How about always referencing all tables via attached db names? That way, main is never referenced, neither explicitly nor implicitly, and is therefore never locked. It's looking more and more as if that's what we'll have

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 11:08 AM, Stephan Beal sgb...@googlemail.com wrote: - TEMP tables get created in the MAIN db (assuming my memory of the docs is correct), which means we can (though accidental misuse or carelessness) end up filling up RAM with temporary tables (which we use regularly to

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Hick Gunter
An: General Discussion of SQLite Database Betreff: Re: [sqlite] quasi-bug related to locking, and attached databases On Mon, Oct 27, 2014 at 11:08 AM, Stephan Beal sgb...@googlemail.com wrote: - TEMP tables get created in the MAIN db (assuming my memory of the docs is correct), which means we can

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 11:53 AM, Hick Gunter h...@scigames.at wrote: TEMP tables get created in database temp; which is located in a file or in memory depending on the SQLITE_TEMP_STORE preprocessor symbol and the pragma temp_store. Which reveals my ignorance on the topic ;). IIRC we aren't

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 11:59 AM, Stephan Beal sgb...@googlemail.com wrote: On Mon, Oct 27, 2014 at 11:53 AM, Hick Gunter h...@scigames.at wrote: TEMP tables get created in database temp; which is located in a file or in memory depending on the SQLITE_TEMP_STORE preprocessor symbol and the

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Nico Williams
On Mon, Oct 27, 2014 at 3:23 AM, Hick Gunter h...@scigames.at wrote: SQLite treats each attached database as a separate entity. Attaching the same file twice is just asking for problems. Well, it could do something to detect duplicates, but it may not be easy (or even possible) to portably

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Stephan Beal
On Mon, Oct 27, 2014 at 8:52 PM, Nico Williams n...@cryptonector.com wrote: Well, it could do something to detect duplicates, but it may not be easy (or even possible) to portably detect that two DB files are the same file. The same is true for the application, of course, but it seems

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Nico Williams
On Mon, Oct 27, 2014 at 3:17 PM, Stephan Beal sgb...@googlemail.com wrote: That's conceptually the same problem we're trying to solve here: keep the public db names stable, regardless of where/how they're actually attached. Yes, I think that's desirable. If it's not too much to ask for then

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Simon Slavin
On 27 Oct 2014, at 9:49pm, Nico Williams n...@cryptonector.com wrote: On Mon, Oct 27, 2014 at 3:17 PM, Stephan Beal sgb...@googlemail.com wrote: That's conceptually the same problem we're trying to solve here: keep the public db names stable, regardless of where/how they're actually attached.

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread Nico Williams
On Mon, Oct 27, 2014 at 5:12 PM, Simon Slavin slav...@bigfraud.org wrote: On 27 Oct 2014, at 9:49pm, Nico Williams n...@cryptonector.com wrote: If it's not too much to ask for then SQLite3 ought to: a) check for duplicates by canonicalized path (but keep in mind that this can be difficult to

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread James K. Lowden
On Mon, 27 Oct 2014 16:49:42 -0500 Nico Williams n...@cryptonector.com wrote: If it's not too much to ask for then SQLite3 ought to: a) check for duplicates by canonicalized path (but keep in mind that this can be difficult to do portably, or without obnoxious length limitations on Windows),

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-25 Thread Stephan Beal
On Fri, Oct 24, 2014 at 11:16 PM, Simon Slavin slav...@bigfraud.org wrote: Which version of SQLite are you using ? What operating system are you using (including which version) ? What formats are the volumes those files are stored on ? Simon, FYI: this is the 'main' db aliasing problem i

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-25 Thread dave
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Stephan Beal Sent: Saturday, October 25, 2014 3:32 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] quasi-bug related to locking,and attached databases

[sqlite] quasi-bug related to locking, and attached databases....

2014-10-24 Thread dave
Hi folks; I may have found a locking-related bug (or not, depending on your perspective). In my situation, I am using a system where several databases have been attached, and I am trying to execute a query which hangs in the busy handler, ultimately because two locks are attempted on the same

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-24 Thread Simon Slavin
On 24 Oct 2014, at 9:54pm, dave d...@ziggurat29.com wrote: Can locking be made more clever to know about aux being an alias for main, and effectively translate the query shown to it's functional equivalent of: insert or replace into main.dest ( name, value ) values ('allow',(select

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-24 Thread dave
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin ... On 24 Oct 2014, at 9:54pm, dave d...@ziggurat29.com wrote: Can locking be made more clever to know about aux being an alias for main, and effectively

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-24 Thread Simon Slavin
On 24 Oct 2014, at 10:40pm, dave d...@ziggurat29.com wrote: Later I can try on linux, but I don't have it at my fingertips just now. I don't mind trying with other versions of sqlite if you think it's helpful, but I suspect it's been there forever. Not gonna ask for this since you've now

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-24 Thread dave
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Friday, October 24, 2014 4:45 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] quasi-bug related to locking,and attached databases