Skip to content

Evaluate expressions in an IN list to close #2771 - #3004

Open
mateuscmtropical wants to merge 1 commit into
AlaSQL:developfrom
mateuscmtropical:fix-2771-in-list-expressions
Open

mateuscmtropical wants to merge 1 commit into
AlaSQL:developfrom
mateuscmtropical:fix-2771-in-list-expressions

Conversation

@mateuscmtropical

Copy link
Copy Markdown
Contributor

Closes #2771

What was wrong

With options.cache on (the default), an IN list that has no parameter was turned into a cached Set built from value.value of each item. Only a literal has a value. A column, a sign, arithmetic, a function or parentheses gave undefined, so the item never matched. -14 is a UniOp too, so even a negative number missed.

What changed

The cached Set is used only when every item is a number or string literal. Any other list takes the path that was already used for parameters: it builds the Set from the compiled items for each row. Lists of literals keep the cache.

Tests

test/test2771.js covers the queries from the issue: a column in the list, signs, arithmetic, a function and parentheses, NOT IN, and plain literal lists. The first three cases fail on develop.

yarn test-only gives 2555 pass. The only failures are the 5 Test 418 cases that load files from the internet.

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.

An expression inside an IN list never matches: WHERE c IN (7 * 2) or IN (1, b) (a regression)

2 participants