SQLite Forum

No query solution when an optimization is off
Login

No query solution when an optimization is off

(1) By Wang Ke (krking) on 2021-06-01 16:12:16 [source]

Hi everyone,

Consider the following test case:

CREATE TABLE t0 (c0 INT);
CREATE UNIQUE INDEX idx ON t0(c0) WHERE (1 in ());

SELECT count(*) FROM t0 INDEXED BY idx, (SELECT t0.c0 IN() AS c0 FROM t0) AS v0 WHERE (v0.c0); -- 0
.testctrl optimizations 0x00000001;
-- disable SQLITE_QueryFlattener
SELECT count(*) FROM t0 INDEXED BY idx, (SELECT t0.c0 IN() AS c0 FROM t0) AS v0 WHERE (v0.c0); -- Error: no query solution

When I disable the optimization SQLITE_QueryFlattener, the query fails.