Repository navigation
Conversation
Co-authored-by: Mathias Wulff <1063454+mathiasrw@users.noreply.github.com>
komal0000
force-pushed
the
fix/in-list-non-literal-items
branch
from
October 29, 2026 15:55
5379bce to
628d77b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2874
Problem
With the statement cache on (the default),
a IN (-1, 5),a IN (1 + 2, 5)anda IN (b, 5)only matched 5, andNOT INlet the same rows through. Withalasql.options.cache = falsethe results were right.Cause
The cached path in
src/50expression.jsbuilds its Set fromitem.valueof each list item.-1is a unary minus,1 + 2an operator andba column, so none of them has avalue, and each becameundefinedin the Set.Fix
The cached Set is now used only when every list item is a
NumValueorStringValue. Any other item (including parameters, which were already excluded) goes through the existing per-querynew Set([...])path, which compiles each item. Lists of plain literals keep the cached Set.Tests
New
test/test2874.js: IN with a negative number, an expression and a column; NOT IN with a negative number and a column; plain literals still work.src/, 5 of the 6 tests fail.bun test ... ./test/test2874.js→ 6 passed.developon my Windows machine, so they are environmental.The fix follows the one described in the issue, so @mathiasrw is credited as co-author.