An assertion failure in function isSimpleCount()
(1) By Wang Ke (krking) on 2021-11-05 09:25:04 [source]
We found an assertion failure in SQLite version 3.37.0 2021-11-02 07:32:13 with debug enabled.
The test case is as follows:
CREATE TABLE t1(a TEXT AS(1>=1),b CHAR(1)); CREATE INDEX t1ab ON t1(a,b); SELECT * FROM t1 WHERE (a, b) IN (SELECT count(CASE WHEN t1.b='xyz' THEN 10 END), COUNT(*) AS ca0 FROM t1 AS ra0) AND t1.b=0;
sqlite3.c:137964: isSimpleCount: Assertion `0' failed.
if( NEVER(pAggInfo->nFunc==0) ) return 0;
Bisecting shows the issue may be related to check-in e994c9f2.
Hope the problem will be handled properly :)
(2) By Richard Hipp (drh) on 2021-11-05 12:03:39 in reply to 1 [link] [source]
Thanks for the report. Now fixed on trunk.
Wang Ke probably already knows this, but for the benefit of other readers, the NEVER() macro in SQLite basically means "we don't have a test case for this condition but we should probably check it anyhow." On debug builds, the NEVER() raises an assertion fault if it is ever true, but for release builds it is a no-op. In that way, NEVER() macros alert us to new untested branches. Release builds are unaffected.
Hence, this is not a problem in release builds.