SQLite Forum

Unexpected output from the SELECT statement
If you type these statements:

  explain select * from v0 where (v1=20) or (v1=10 and v2=10);

  explain select * from v0 where (v1=20) union select * from v0 where (v1=10 and v2=10);

You'll see that it generates very different VM programs for the first than the last. The second explain output clearly shows that v2 is checked, but not in the first.

Someone with more knowledge about the code generator will have to speak as to why the code generator works that way at present and what was necessary to eventually fix it.