[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread R.Smith
On 2015-04-11 06:12 PM, Simon Slavin wrote: > On 11 Apr 2015, at 4:13pm, Keith Medcalf wrote: > >> Interestingly if you run analyze, it works properly ... > Oh my. I don't like the idea that ANALYZE changes the result set. > > Simon. Yes, that would be worrisome... but not to worry, the bug i

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Richard Hipp
This problem is fixed on trunk. Thanks for the report. On 4/11/15, Mike Gladysch wrote: > Hi, > > I expected that SQLite misbehaves in current versions. Since 3.8.4.3 > (bundled with PHP 5.5.20 and PHP 5.6.4) all is still ok, but with next > update of PHP there is SQLite 3.8.7.2 bundled. > > Tab

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Simon Slavin
On 11 Apr 2015, at 4:13pm, Keith Medcalf wrote: > Interestingly if you run analyze, it works properly ... Oh my. I don't like the idea that ANALYZE changes the result set. Simon.

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread R.Smith
Yep, it's a Bug since at least 3.8.8. Minimal Test-case to reproduce: create table t( c1 integer primary key, c2 integer, c3 integer, UNIQUE (c2, c3) ); insert into t values( 1,null,'a'); insert into t values( 2,null,'a'); insert into t values( 3,'xxx','a'); select * from t; --

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Clemens Ladisch
Mike Gladysch wrote: > Select col1, col2, col3, col4, col5, col6 > From table > Where col3 is null and col4 ='test' That is not valid SQL. > 3.8.4.3: 3 rows (expected, ok) > 3.8.7.2: 1 row (wrong) How to reproduce: create table t(x, y, unique(x, y)); insert into t values(null, 1); insert

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Simon Davies
On 11 April 2015 at 07:07, Mike Gladysch wrote: > Hi, . > Data: > 1;1;null;test;null;null > 2;2;null;test;null;null > 3;3;null;test;null;null > 4;4;something;test;null;null > > Select col1, col2, col3, col4, col5, col6 > From table > Where col3 is null and col4 ='test' > > Delivers different resu

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Keith Medcalf
t;From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- >bounces at mailinglists.sqlite.org] On Behalf Of R.Smith >Sent: Saturday, 11 April, 2015 06:09 >To: sqlite-users at mailinglists.sqlite.org >Subject: Re: [sqlite] Select query becomes distinct on where matches >u

[sqlite] Select query becomes distinct on where matches unique with null value

2015-04-11 Thread Mike Gladysch
Hi, I expected that SQLite misbehaves in current versions. Since 3.8.4.3 (bundled with PHP 5.5.20 and PHP 5.6.4) all is still ok, but with next update of PHP there is SQLite 3.8.7.2 bundled. Table: 6 colums including an primary on col1, an unique on col2 (not null), an unique on col3 nullable,