Hello,

I'm seeing strange input given into xBestIndex method of my virtual table.

I'm maintaining sqlite4java wrapper and I'm trying to upgrade it from SQLite
3.7.4 to 3.7.7.1. A couple of failed tests uncovered that there's a problem
when searching a simple virtual table with constraints that contain NULL. 

More specifically, the virtual table is declared as follows in xCreate
method:
   
     CREATE TABLE x(value INTEGER)

When the following SQL is executed:

     SELECT value FROM table WHERE value IS NOT NULL

, xBestIndex receives the following parameters:

pIdxInfo->nConstraint == 1
pIdxInfo->aConstraint[0].usable == 1
pIdxInfo->aConstraint[0].iColumn == 0
pIdxInfo->aConstraint[0].op == 4 (GT)

So basically the search is going to be for condition "value > ?".

When xFilter is called, the value passed is NULL. So instead of searching
for "value IS NOT NULL" the module is instructed to search for "value >
NULL" - which gives the opposite result. And when SQL executed is "SELECT
value FROM table WHERE value > NULL", all the parameters are identical.

This problem did not exist in SQLite 3.7.4.

Do I miss something or is this a bug? 

Thanks for your help,
Igor


-- 
View this message in context: 
http://old.nabble.com/Virtual-Table-xBestIndex-and-NULL-Search-Conditions-%28Bug-%29-tp32172549p32172549.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to