SQLite Forum

'ON DELETE CASCADE' seems to not be working
Login
Identification is based on the fact that candidate rows resulting from the fixed traversal requirement of the LHS table to the RHS table will subsequently eliminate the outer candidate results (where all the RHS columns are null) because at least one column of the RHS table is constrained not null.

Simple example:

`select * from t1 left join t2 on t1.a == t2.a where t2.b == 4;`

since t2.b cannot be null in the projection result the outer join is really a misspoken inner join and there is not longer a descent order constraint between t1 and t2, and the query planner is free to optimize the query as if

`select * from t1 join t2 on t1.a == t2.a where t2.b == 4;`

had been given.

Similarly for:

`select * from t1 left join t2 on t1.a == t2.b join t3 on t3.b == t2.b;`

where the results from the outer join can never affect the result because t2.b is constrained not null and therefore the outer join is really an inner join.