You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A constant IN list returns the answer of an earlier list with the same text: 1 IN (1) is false after '1' IN ('1') #2753
A constant IN (...) list can return the answer of an earlier query whose list has the same text. Seen in the sqllogictest run (evidence/in1.test) and reproduced on develop (06211a0):
alasql("SELECT VALUE '1' IN ('1')");// truealasql('SELECT VALUE 1 IN (1)');// false, expected truealasql("SELECT VALUE 'a,b' IN ('a,b')");// truealasql("SELECT VALUE 'a' IN ('a','b')");// false, expected truealasql("SELECT VALUE 'a,b' IN ('a','b')");// true, expected falsealasql("SELECT VALUE 'a' IN ('a')");// truealasql("SELECT VALUE 'a' IN (a)");// false: the column a is not read
Each query alone gives the right answer. NOT IN behaves the same way.
Context
With the statement cache on, Op.toJS in src/50expression.js (the IN and NOT IN branches) keeps the Set of a constant list in alasql.sets, keyed by allValues.join(','). The key loses the type ('1' and 1 both give 1) and the boundaries between values ('a,b' and 'a','b' both give a,b). The list values are taken as value.value, which is undefined for a column, so a column in the list is not read.
A wrong result that depends on what ran before, so not breaking.
Activity
mateuscmtropical commentedon Nov 11, 2026
Hi, I'd like to work on this one.
mateuscmtropical commentedon Nov 11, 2026
Hi, I've opened a PR for this: #3044