Files
turso/core/translate
Jussi Saurio c0da38e24a Merge 'Clear WhereTerm 'from_outer_join' state when LEFT JOIN is optimized to INNER JOIN' from Jussi Saurio
Closes #3470
## Background
In a query like `SELECT * FROM t LEFT JOIN s ON t.a=s.a WHERE s.a =
'foo'` we can remove the LEFT JOIN and replace it with an `INNER JOIN`
because NULL values will never be equal to 'foo'. Rewriting as `INNER
JOIN` allows the optimizer to also reorder the table join order to come
up with a more efficient query plan. In fact, we have this optimization
already.
## Problem
However, there is a dumb bug where `WhereTerm`s involving this join
still retain their `from_outer_join` state, resulting in forcing the
evaluation of those terms at the original join index, which results in
completely wrong bytecode if the join optimizer decides to reorder the
join as `s JOIN t` instead. Effectively it will evaluate `t.a=s.a` after
table `s` is open but table `t` is not open yet.
## Fix
This PR fixes that issue by clearing `from_outer_join` properly from the
relevant `WhereTerm`s.

Closes #3475
2025-10-02 06:56:07 +03:00
..
2025-09-25 17:14:54 -04:00
2025-09-30 10:00:16 +03:00
2025-09-26 12:17:34 -04:00
2025-09-29 16:30:07 +04:00
2025-09-26 13:01:49 +04:00
2025-09-29 17:18:19 -04:00
2025-09-30 15:28:50 +04:00
2025-06-11 18:38:56 +02:00
2025-09-13 11:12:44 +02:00
2025-10-01 14:20:23 -04:00