SQLite Forum

Discovered bug in xBestIndex of virtual tables
That's not true. The constraint in example #2 is not related to the JOIN at all. Both `foo` and `bar` are columns of the same table.

In fact, if you remove `foo = ?`, then example #2 generates zero constraints. So it's clearly doing some transitive logic here. It knows that `bar = ?` based on `foo = ? AND bar = foo`. I think that's very clever and desirable behavior, but we don't get the same behavior in example #4 unfortunately.