SQLite

View Ticket
Login
Ticket Hash: 10fb063b1179be53ea0b53bbb4459b5597541a4b
Title: Duplicate row output on an OR query
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2014-04-10 02:24:43
Version Found In: 3.8.4.3
User Comments:
drh added on 2014-04-10 02:09:30:

The following query returns two rows instead of just one:

create table t(c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17);
create index tc0 on t(c0);
create index tc1 on t(c1);
create index tc2 on t(c2);
create index tc3 on t(c3);
create index tc4 on t(c4);
create index tc5 on t(c5);
create index tc6 on t(c6);
create index tc7 on t(c7);
create index tc8 on t(c8);
create index tc9 on t(c9);
create index tc10 on t(c10);
create index tc11 on t(c11);
create index tc12 on t(c12);
create index tc13 on t(c13);
create index tc14 on t(c14);
create index tc15 on t(c15);
create index tc16 on t(c16);
create index tc17 on t(c17);

insert into t(c0, c16) VALUES (1,1);

select * from t where
  c0=1 or  c1=1 or  c2=1 or  c3=1 or
  c4=1 or  c5=1 or  c6=1 or  c7=1 or
  c8=1 or  c9=1 or c10=1 or c11=1 or
  c12=1 or c13=1 or c14=1 or c15=1 or
  c16=1 or c17=1;

This problem has been latent in the code for about 5 years, since checkin [b101cf70b75c9772aaf] of version 3.6.14. The bug was found by Peter Reid and reported on the sqlite-dev mailing list.