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
IN (5, 6) and IN ('5', '6') share one cached set, so the result depends on which query ran first #2912
An IN list is turned into a Set once and cached in alasql.sets, keyed by the values joined with commas. The key does not tell numbers from strings, so IN (5, 6) and IN ('5', '6') share one cached set, and the second query uses the values of whichever ran first.
vardata=[{a: 5},{a: '5'},{a: 6}];alasql('SELECT VALUE COUNT(*) FROM ? WHERE a IN (5, 6)',[data]);// 2, rightalasql("SELECT VALUE COUNT(*) FROM ? WHERE a IN ('5', '6')",[data]);// 2, should be 1
Run the string query first and it gives 1, and then the number query gives 1 instead of 2. The same goes for NOT IN. Measured on develop and 4.21.0.
A key that keeps the type of each value, like JSON.stringify of the list, fixes it.
Activity
Fix value type cache for IN to close AlaSQL#2912 (AlaSQL#2913)