Unexpected execution result
(1) By Zhaokun Xiang (silva9988) on 2025-07-23 10:59:14 [source]
Dear SQLite Developers,
I meet a wrong execution result. Please see the below cases. I can reproduce it on the version SQLite version 3.51.0 2025-07-22 15:51:41 and the latest Check-in [c10f9970c6] of trunk. I would like to express my gratitude to your efforts in bug fixing and detailed analysis!
CREATE TABLE t0 (c0 INT);
INSERT INTO t0(c0) VALUES (1);
CREATE TABLE t1(c0 INT);
INSERT INTO t1(c0) VALUES (2);
SELECT * FROM t1 WHERE EXISTS (SELECT 1 FROM t0 LIMIT 0);
-- Wrong Execution Result: 2
-- Expected Result: Empty Result
(2) By Richard Hipp (drh) on 2025-07-23 12:19:23 in reply to 1 [link] [source]
This is a problem in the new EXISTS-to-JOIN optimization which has not (yet) appeared in any official release. It is always best to catch these kinds of problems before a release rather than afterwards. So thanks for that!