[sqlite] SQL-query execution bug

2011-01-19 Thread Vadim Smirnov
Hello!
I've found a bug in execution queries like this:
SELECT ... FROM table T JOIN table2 T2 ON T2.child=T.master
WHERE T2.attr in(SELECT value FROM table3 T3 JOIN (SELECT group, MAX(value) 
FROM table4 T4 WHERE T4.date_value=T2.date_value GROUP BY group) G ON 
G.group=T3.group)
Such queries returns empty resultset because of invalid evaluation WHERE 
T4.date_value=T2.date_value. It seems that SQLite evaluates WHERE 
T4.date_value=null in fact.
If we replace WHERE T4.date_value=T2.date_value with WHERE 
T4.date_value=const value everything will be okey.

Sincerely Yours, Wadim Smirnov
System architect
Positive Technologies CJSC, Russia
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL-query execution bug

2011-01-19 Thread Richard Hipp
On Tue, Jan 18, 2011 at 12:07 PM, Vadim Smirnov vsmir...@ptsecurity.ruwrote:

 Hello!
 I've found a bug in execution queries like this:
 SELECT ... FROM table T JOIN table2 T2 ON T2.child=T.master
 WHERE T2.attr in(SELECT value FROM table3 T3 JOIN (SELECT group, MAX(value)
 FROM table4 T4 WHERE T4.date_value=T2.date_value GROUP BY group) G ON
 G.group=T3.group)
 Such queries returns empty resultset because of invalid evaluation WHERE
 T4.date_value=T2.date_value. It seems that SQLite evaluates WHERE
 T4.date_value=null in fact.


It works when I try it.

Why don't you send us a specific example that does not work for  you
(including CREATE TABLE statements and INSERTs to fill the tables with data)
and we'll have another look.



 If we replace WHERE T4.date_value=T2.date_value with WHERE
 T4.date_value=const value everything will be okey.

 Sincerely Yours, Wadim Smirnov
 System architect
 Positive Technologies CJSC, Russia
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users