Thanks for the report. Sometimes [fixing one bug][1] creates a [new one][2]. This is especially true when the [query flattening optimization][3] tangles with a LEFT JOIN operator. Both problems should now be fixed on trunk. Please follow-up if you find otherwise. [1]: https://www.sqlite.org/src/info/ac31edd3eeafcef4 [2]: https://www.sqlite.org/src/info/871f2ddcfbb9196d [3]: https://www.sqlite.org/optoverview.html#subquery_flattening