Assertion failure "pExpr->pAggInfo==pAggInfo"
(1) By Wang Ke (krking) on 2021-08-21 11:31:20 [link] [source]
We found an assertion failure in the latest SQLite, and the test case is as follows:
CREATE TABLE t1(a); SELECT MIN((SELECT NULL FROM t1 UNION SELECT 'X' FROM (SELECT NULL FROM (SELECT 1 WHERE t1.a=1) UNION ALL SELECT 'X' FROM (SELECT 2)))) FROM t1;
sqlite3.c:139665: sqlite3Select: Assertion `pExpr->pAggInfo==pAggInfo' failed.
Bisecting shows the issue may be introduced in check-in 7682d8a768.
(2) By Richard Hipp (drh) on 2021-08-21 16:51:05 in reply to 1 [source]
Thanks for the report.
A fix is in check-in 600f1991e5c0a5d8. This problem is associated with some sanity checking. The assertion fault does not occur and the coding error is harmless for release builds.
The assertion fault occurs in a block of code at the end of the SELECT code generation for aggregate queries. This block of code (which only runs during debugging builds and is omitted completely from release builds) does sanity checking on internal data structures. The error occurs when one of those data structures (an Expr object) is deleted by an optimization in the middle of code generation. The fix in 600f1991e5c0a5d8 is to simply defer the object deletion until after all code generation completes, so the objects are still available for sanity checking down at the end of SELECT code generation.
(3) By Wang Ke (krking) on 2021-08-21 17:33:37 in reply to 2 [link] [source]
Thanks for your explanation.
It's good to know that is a harmless coding error which not affects the normal execution process.
By the way, recently we're collecting more testcases, especially those triggering errors(crashes or logical errors) in old versions in order to find out more potential problems with our approach. We have noticed that TH3 is a useful tool for you developers to conduct testing works. So we are trying to find those TH3 testing modules like "orindex01.test". But I didn't find the file in the directory of SQLite. I wonder, how can we access these test data? Or are those data not public?
Looking forward to your reply.