[sqlite] Bug report for MAX()

2015-11-25 Thread R Smith
Many thanks to all. I should have checked - That table was not supposed to be able to even get strings in there - this exposed a bug in an application of ours too. Adding check constraints right away. Thanks! On 2015/11/25 1:56 PM, Richard Hipp wrote: > On 11/25/15, Dave McKee wrote: >> I

[sqlite] Bug report for MAX()

2015-11-25 Thread R Smith
It seems there are some instances where MAX() does not return a value. I will send such an offending DB direct, but the sqlite3.exe results as follows: F:\[BACKUP]>sqlite3.exe IPDB_ImptData.idb SQLite version 3.9.2 2015-11-02 18:31:45 Enter ".help" for usage hints. sqlite> SELECT max(UnitCost)

[sqlite] Bug report for MAX()

2015-11-25 Thread Simon Slavin
On 25 Nov 2015, at 11:39am, Dave McKee wrote: > Is this a possible explanation? You got it. This is part of what I was worried about. MAX processes not just numbers. It would be useful to know what kind of values Ryan has stored in that column. Simon.

[sqlite] Bug report for MAX()

2015-11-25 Thread Dave McKee
I can replicate this behaviour if I insert a zero-length string into the column. sqlite> create table foo(a); sqlite> insert into foo values(5); sqlite> insert into foo values(""); sqlite> select max(a) from foo; sqlite> select min(a) from foo; 5 sqlite> select avg(a) from foo; 2.5 Is this a

[sqlite] Bug report for MAX()

2015-11-25 Thread Simon Slavin
On 25 Nov 2015, at 11:09am, R Smith wrote: > sqlite> SELECT max(UnitCost) FROM BOMData; > > sqlite> SELECT min(UnitCost) FROM BOMData; > 0.0 Can you please post the result of SELECT DISTINCT typeof(UnitCost) FROM BOMData; (I think that's how you do it. You might need to use GROUP BY.)

[sqlite] Bug report for MAX()

2015-11-25 Thread Richard Hipp
On 11/25/15, Dave McKee wrote: > I can replicate this behaviour if I insert a zero-length string into the > column. > > sqlite> create table foo(a); > sqlite> insert into foo values(5); > sqlite> insert into foo values(""); > sqlite> select max(a) from foo; > > sqlite> select min(a) from foo; > 5