my sql query in sqlite3 ends with a OR statement. It looks like this:
select
(...)
from
T1, T2, .... Tn
where
(...) and
(
(T5.v='s1' and T6.v='s2' and T7.v='s3') OR
(T5.v='s4' and T6.v='s5' and T7.v='s6')
)
the query returns no result.
However each distinct 'OR' conditions returns some rows (!)
where
(...) and
(
(T5.v='s1' and T6.v='s2' and T7.v='s3')
)
and
where
(...) and
(
(T5.v='s4' and T6.v='s5' and T7.v='s6')
)
is it a bug in sqlite3 or is it me ?
$ sqlite3 -version
3.6.20
update: I've got three non-unique indexes on T5.v, T6.v and T7.v
As said previously in the comments, the changelog of sqlite 3-6-22 includes:
Fix bugs that can (rarely) lead to incorrect query results when the CAST or OR operators are used in the WHERE clause of a query.
Another OR bug was fixed in 3-7-4:
http://www.sqlite.org/src/info/80ba201079
Another one in 3-7-14-1:
Fix a bug (ticket [d02e1406a58ea02d]]) that causes a segfault on a LEFT JOIN that includes an OR in the ON clause.
and another one in 3-7-17:
http://www.sqlite.org/src/info/f2369304e4
I would suggest to upgrade to a more recent sqlite version, and see if it fixes the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With