Re: [sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Peter da Silva
The only way I can think of to have a large counter in a lock is to lock access to a file containing a counter and I don't know if not-a-file-system semantics support that. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Pierre Tempel
It might be worth investigating some other projects that use lock files. Git, as mentioned locks the index with a lock file, but AFAIK without counting. As a reference for the NFS issue, see https://dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html section 7.11.2.1, which

Re: [sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Richard Hipp
On 12/15/18, Pierre Tempel wrote: > > Hm. Doesn't this mean the proposed solution still works, but with > directories instead of files for the sake of atomicity? I.e. for each > lock type, create a unique dir name (e.g. ".1.lock") and stat for all > lock types when changing levels? I think you

Re: [sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Pierre Tempel
No. Unfortunately, if all you have is the presence or absence of a directory to determine if the file is locked, then that is only one bit of information. And there is no way to encode all the other locking states in a single bit. Hm. Doesn't this mean the proposed solution still works, but

Re: [sqlite] Question about floating point

2018-12-15 Thread Keith Medcalf
On Saturday, 15 December, 2018 10:54, Simon Slavin wrote: >On 15 Dec 2018, at 5:35pm, Keith Medcalf wrote: >> Fast forward 25 years and you would these days be hard pressed to >find a computer that DOES NOT use proper IEEE-754 floating point and >that DOES NOT default to a minimum of double

Re: [sqlite] Question about floating point

2018-12-15 Thread Simon Slavin
On 15 Dec 2018, at 5:35pm, Keith Medcalf wrote: > Fast forward 25 years and you would these days be hard pressed to find a > computer that DOES NOT use proper IEEE-754 floating point and that DOES NOT > default to a minimum of double precision representation and that DOES NOT use > extended

Re: [sqlite] Question about floating point

2018-12-15 Thread Keith Medcalf
On Friday, 14 December, 2018 23:49, Frank Millman wrote: > I know that floating point is not precise and not suitable for > financial uses. This is debatable. In the "old days" of what was called "fast floating point" it was certainly true since the epsilon of a "fast floating point" number

Re: [sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Richard Hipp
On 12/15/18, Pierre Tempel wrote: > > First, dot-file actually uses a directory, however, the comments don't seem > to give a reason for this. Why is a directory created, instead of a more > (arguably) traditional lock file (see e.g. git)? dotlockLock creates the > directory with permissions set

[sqlite] [Question] Non-EXCLUSIVE modes in dot-file locking strategy

2018-12-15 Thread Pierre Tempel
Hi, I'm currently working with a system where dot-file is the only applicable SQLITE_ENABLE_LOCKING_STYLE and I'm trying to understand how this is implemented exactly. So I've read through the implementation of this locking strategy and a few questions came to mind: First, dot-file actually uses

Re: [sqlite] FOREIGN KEY constraint not respected during bulk insert using TRANSACTION

2018-12-15 Thread Kees Nuyt
On Fri, 14 Dec 2018 15:05:29 +, Morten Joergensen wrote: > Hi, > > I have two tables, the second with a FOREIGN KEY - ON DELETE > CASCADE to the primary key on the first table. When I do a > transaction inserting a lot of records into the second table > at once, I am allowed to insert

[sqlite] FOREIGN KEY constraint not respected during bulk insert using TRANSACTION

2018-12-15 Thread Morten Joergensen
Hi, I have two tables, the second with a FOREIGN KEY - ON DELETE CASCADE to the primary key on the first table. When I do a transaction inserting a lot of records into the second table at once, I am allowed to insert records that do not fulfill the constraint, i.e. having values in the foreign

Re: [sqlite] Question about floating point

2018-12-15 Thread Simon Slavin
On 15 Dec 2018, at 10:15am, Frank Millman wrote: > Simon Slavin says ‘Currency amounts should be stored as integers’. Does this > apply to sqlite3 specifically, or is that your recommendation for all > databases? For anything that goes near a computer. I used to work with international

Re: [sqlite] Question about floating point

2018-12-15 Thread Niall O'Reilly
On 15 Dec 2018, at 10:15, Frank Millman wrote: Simon Slavin says ‘Currency amounts should be stored as integers’. Does this apply to sqlite3 specifically, or is that your recommendation for all databases? It doesn't matter whether a database is involved. Using integers for currency amounts

Re: [sqlite] Question about floating point

2018-12-15 Thread Frank Millman
On 2018-12-14 11:24 AM, Darren Duncan wrote: > > If yours is a financial application then you should be using exact numeric > types only, such as integers that represent multiples of whatever quantum you are using, such as cents; fractional numbers are a display or user input format only,

Re: [sqlite] Question about floating point

2018-12-15 Thread Simon Slavin
On 15 Dec 2018, at 9:24am, Darren Duncan wrote: > If yours is a financial application then you should be using exact numeric > types only, such as integers that represent multiples of whatever quantum you > are using, such as cents; fractional numbers are a display or user input > format

Re: [sqlite] Question about floating point

2018-12-15 Thread Darren Duncan
If yours is a financial application then you should be using exact numeric types only, such as integers that represent multiples of whatever quantum you are using, such as cents; fractional numbers are a display or user input format only, and in those cases they are character strings. -- Darren

Re: [sqlite] Expression-index bug with OR query

2018-12-15 Thread Dan Kennedy
On 12/14/2018 07:22 AM, Jens Alfke wrote: We’ve found a bug where creating indexes on expressions causes a query to give incorrect results. Our indexes use some complex custom functions, but the bug is easy to reproduce just using the ‘abs’ function: SELECT * FROM docs WHERE abs(a)=2