Commit 692b0e2
fix(exec): eagerly reject a bad column on the LHS of an IN (SELECT)
The tested expression of `x [NOT] IN (SELECT …)` is a column reference of the
enclosing query, so a bad one (`nope IN (SELECT …)`) is a prepare-time
`no such column` in SQLite — raised even over an empty or fully filtered input,
and even when the `IN (SELECT)` is nested inside another subquery's WHERE. The
shallow-column walker used by the eager validators visited the operand of
`InList` but had no arm for `InSelect`, so the LHS fell through to the catch-all
and was only resolved lazily, per row — missing the error when no row is reached.
Add an `InSelect` arm that visits the tested expression (the subquery body is a
separate scope, validated by the existing recursion). A valid or aliased LHS
(`count(*) IN (…)`, an output alias in HAVING/ORDER) is still accepted. Verified
vs sqlite3 3.50.4 (`tests/eager_in_select_lhs.rs`).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 257924e commit 692b0e2
2 files changed
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26894 | 26894 | | |
26895 | 26895 | | |
26896 | 26896 | | |
| 26897 | + | |
| 26898 | + | |
| 26899 | + | |
| 26900 | + | |
26897 | 26901 | | |
26898 | 26902 | | |
26899 | 26903 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
0 commit comments