Commit c554d76
committed
core/analyzer: bind FROM items against the scope being built
A set-returning function in FROM takes its arguments from the items before
it, so bindRangeFunction types the call while the scope is still being
assembled. The scope under construction was never installed on the analyzer,
so a.scope was nil and resolving one of those arguments dereferenced it:
FROM transactions,
jsonb_each(jsonb_extract_path(transactions.data, '...')) AS x
buildScope and relationScope now install the scope they are filling for as
long as they fill it, and put back the one they replaced on the way out.
Resolving against a nil scope also reports the column as unresolved rather
than crashing, so no other half-built statement can panic on the way to the
error it was going to report anyway.
Both queries now analyze to an ordinary error instead of taking down the
process, which is what the rest of the corpus needed: TestReplay's core
context runs to completion in one process rather than aborting partway.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161e7oMkzNW9DZMUPtyQibH1 parent e56435b commit c554d76
2 files changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
| |||
202 | 214 | | |
203 | 215 | | |
204 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
205 | 223 | | |
206 | 224 | | |
207 | 225 | | |
| |||
0 commit comments