SQLite Forum

Assertion failure "pExpr->pAggInfo==pAggInfo"
Thanks for the report.

A fix is in [check-in 600f1991e5c0a5d8](src:/info/600f1991e5c0a5d8).  This
problem is associated with some sanity checking.  The assertion fault does
not occur and the coding error is harmless for release builds.

## Details

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](/info/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.