Skip to content

Do not reuse a join index keyed on a parameter to close #3075 - #3076

Merged
mathiasrw merged 3 commits into
AlaSQL:developfrom
zzoraemon043:fix-3075-join-index-params
Nov 17, 2026
Merged

mathiasrw merged 3 commits into
AlaSQL:developfrom
zzoraemon043:fix-3075-join-index-params

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

Closes #3075

preIndex caches the join index on the table under a hash of onrightfns + srcwherefns. When that expression reads params[...], the cached index only matches the values of the first run, so a later run with other values reuses it and returns wrong rows.

Now an index whose key expression reads a parameter is built for the run and is neither looked up nor stored on the table. Indexes without parameters are still cached as before.

test/test3075.js covers a positional ? and a named $d in JOIN ... ON, a ? in a FROM s, w WHERE join condition, and checks that a parameter-free index is still reused. The three parameter cases fail on develop and pass with the change.

Full suite (bun, Windows): 2636 pass, 9 fail. The same 9 fail on develop without the change (Excel sourcefilename tests in 107-B and two piped-input CLI tests).

@mathiasrw mathiasrw added this to the v4.x Focus milestone Nov 17, 2026
@mathiasrw
mathiasrw merged commit 49498c5 into AlaSQL:develop Nov 17, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A parameter in a JOIN ON condition reuses the index built with the first value

2 participants