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
An expression inside an IN list never matches: WHERE c IN (7 * 2) or IN (1, b) (a regression) #2771
An IN list matches only plain literals. Any expression in the list never matches: a column (WHERE a IN (1, b), WHERE c0 IN (c0)), a sign (IN (+ 14), even a negative number: IN (-14)), arithmetic (IN (7 * 2)), a function (IN (ABS(-14))) or parentheses (IN ((14))). It is a regression: it worked from 0.3.0 to 4.1.11, failed in 4.2.0, worked again in 4.2.1 and fails since 4.2.2. Those releases brought "Performance optimizations" (#1822, 4.2.0) and "Support cache for WHERE (NOT) IN" (#1834, 4.2.2). Seen about 7,000 times in the sqllogictest run (test/random/aggregates/, for example WHERE col1 IN ( - ( col1 ), ..., col1, ... ) and WHERE + col1 NOT IN ( + 14 )), reproduced on develop (06211a0) and npm 4.20.1, compared with SQLite 3.43.2:
alasql('SELECT a FROM ? WHERE a IN (1, b)',[[{a: 1,b: 5},{a: 5,b: 5},{a: 7,b: 3}]]);// 4.1.11: [{a: 1}, {a: 5}] since 4.2.2: [{a: 1}]
NOT IN gives the opposite: c1 NOT IN (+ 14) keeps the row.
Not breaking: the fix gives back the answer of 4.1.11 and before. The '14' row is the other way round: today's loose match of text and number has been there since 4.2.2, so changing it would be breaking. Related: #2753 (a constant IN list returns the answer of an earlier list with the same text).
changed the title [-]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (regression since 4.2.2)[/-][+]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (a regression)[/+]on Oct 21, 2026
changed the title [-]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (a regression)[/-][+]An expression inside an IN list never matches: WHERE c IN (7 * 2) or IN (1, b) (a regression)[/+]on Oct 21, 2026
A correction to the c1 IN ('14') row: it is not a loose match of text and number. It is the IN list cache of #2753. The answer depends on which list ran first in the process (npm 4.20.1, CREATE TABLE v (c1 INTEGER) holding 14):
Order in one process
c1 IN (14)
c1 IN ('14')
IN ('14') first, then IN (14)
no match (wrong)
no match
IN (14) first, then IN ('14')
match
match
Run alone, c1 IN ('14') never matches, and neither does c1 = '14'. So nobody can rely on the match, and no part of this issue is breaking. The cache fix belongs to #2753.
SQLite 3.43.2 matches in both cases for an INTEGER column, because the column's affinity turns '14' into 14 (c1 = '14' matches too). For a column without a type it does not match.
Activity
[-]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (regression since 4.2.2)[/-][+]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (a regression)[/+][-]A column inside an IN list is not read per row: WHERE a IN (1, b) matches only 1 (a regression)[/-][+]An expression inside an IN list never matches: WHERE c IN (7 * 2) or IN (1, b) (a regression)[/+]mathiasrw commentedon Oct 21, 2026
A correction to the
c1 IN ('14')row: it is not a loose match of text and number. It is theINlist cache of #2753. The answer depends on which list ran first in the process (npm 4.20.1,CREATE TABLE v (c1 INTEGER)holding 14):c1 IN (14)c1 IN ('14')IN ('14')first, thenIN (14)IN (14)first, thenIN ('14')Run alone,
c1 IN ('14')never matches, and neither doesc1 = '14'. So nobody can rely on the match, and no part of this issue is breaking. The cache fix belongs to #2753.SQLite 3.43.2 matches in both cases for an
INTEGERcolumn, because the column's affinity turns'14'into 14 (c1 = '14'matches too). For a column without a type it does not match.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: #3004