Re: [sqlite] Divide by 0 not giving error

2014-09-17 Thread Markus Schaber
Hi, Von: Jean-Christophe Deschamps > > > This would means that if ever an SQL statement encounters divide by > > > zero, the application will crash with no way handle the situation > > > gracefully, nor to locate the source of the problem. > > > >Seriously, what are you talking about? Why is t

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread Jean-Christophe Deschamps
> This would means that if ever an SQL statement encounters divide by > zero, the application will crash with no way handle the situation > gracefully, nor to locate the source of the problem. Seriously, what are you talking about? Why is there "no way to handle" the error, gracefully otherwis

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread James K. Lowden
On Tue, 16 Sep 2014 08:59:31 +0200 Jean-Christophe Deschamps wrote: > This would means that if ever an SQL statement encounters divide by > zero, the application will crash with no way handle the situation > gracefully, nor to locate the source of the problem. Seriously, what are you talking a

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread James K. Lowden
On Tue, 16 Sep 2014 01:42:11 +0100 Simon Slavin wrote: > > Whether or not something "is an error" is a matter of definition. > > SQLite defines division by zero to be NULL. It's very unusual in > > that regard. > MySQL does it too unless ERROR_FOR_DIVISION_BY_ZERO mode is enabled: ... > Postgre

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread Jean-Christophe Deschamps
What the SQL standard calls an "exception" is not necessarily exactly the same as an exception in other programming languages. Granted. If SQLite were to change the division-by-zero handling, it could be reported exactly like most other errors, by returning SQLITE_ERROR from sqlite3_step().

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread Clemens Ladisch
Jean-Christophe Deschamps wrote: > There is another good reason why raising an exception would be > a terrible choice. When SQLite is used as a shared library by some > scripting language, there is /*no*/ possibility to trap exceptions > raised within the library. What the SQL standard calls an "e

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread Jean-Christophe Deschamps
Dear forum, MySQL does it too unless ERROR_FOR_DIVISION_BY_ZERO mode is enabled: SQL Server does it too unless SET ARITHABORT is ON: PostgreSQL doesn't do i

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Markus Schaber
Hi, Dave, Von: Dave Wellman > The problem deals with dividing by 0. As far as I can remember, in every > programming language that I have ever used and in all databases that I've > used, if you try and divide by 0 the process will fail with a 'divide by > zero' error. Sqlite doesn't seem to d

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Simon Slavin
On 16 Sep 2014, at 1:23am, James K. Lowden wrote: > Whether or not something "is an error" is a matter of definition. > SQLite defines division by zero to be NULL. It's very unusual in that > regard. MySQL does it too unless ERROR_FOR_DIVISION_BY_ZERO mode is enabled:

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread James K. Lowden
On Mon, 15 Sep 2014 21:13:01 +0100 Simon Slavin wrote: > > I suppose we then get into a discussion of what is the 'correct > > result'. I completely understand that NULL is unknown, but I've > > always thought that there is a difference between unknown and > > 'error'. > > It is not an error to

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread RSmith
On 2014/09/15 22:13, Simon Slavin wrote: On 15 Sep 2014, at 8:33pm, Dave Wellman wrote: Simon, I'm really surprised at that. Effectively what this means is that the answer that Sqlite returns may or may not be the correct result. What ? No. It's correct. The answer is not known, and NULL

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread RSmith
On 2014/09/15 20:50, Dave Wellman wrote: Hi all, I've found that an sql request that I expected to fail, but it didn't. On the face of it that is good news but there is a potential downside. I wonder if my expectation is wrong or if this is a bug which so far hasn't been caught. The probl

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Simon Slavin
On 15 Sep 2014, at 8:33pm, Dave Wellman wrote: > Simon, > I'm really surprised at that. Effectively what this means is that the answer > that Sqlite returns may or may not be the correct result. What ? No. It's correct. The answer is not known, and NULL means "I don't know". Given that any

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Dave Wellman
sqlite.org] On Behalf Of Simon Slavin Sent: 15 September 2014 20:02 To: General Discussion of SQLite Database Subject: Re: [sqlite] Divide by 0 not giving error On 15 Sep 2014, at 7:50pm, Dave Wellman wrote: > Should trying to divide by 0 result in an error? No. There's no mechanism

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Simon Slavin
On 15 Sep 2014, at 7:50pm, Dave Wellman wrote: > Should trying to divide by 0 result in an error? No. There's no mechanism for reporting a mathematical error in SQL. You can report malformed commands, references to entities (tables, columns, etc.) which don't exist, and complete failure (da

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread Richard Hipp
On Mon, Sep 15, 2014 at 2:50 PM, Dave Wellman wrote: > > The problem deals with dividing by 0. As far as I can remember, in every > programming language that I have ever used and in all databases that I've > used, if you try and divide by 0 the process will fail with a 'divide by > zero' error. S

[sqlite] Divide by 0 not giving error

2014-09-15 Thread Dave Wellman
Hi all, I've found that an sql request that I expected to fail, but it didn't. On the face of it that is good news but there is a potential downside. I wonder if my expectation is wrong or if this is a bug which so far hasn't been caught. The problem deals with dividing by 0. As far as I ca