1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Avoid deleting expression nodes in the flattener code, as they may be referenced by AggInfo objects further up the stack.

FossilOrigin-Name: cc1fffdeddf422404170fa163ab80372ae58b444d7012b2c164021b221709b3e
This commit is contained in:
dan
2020-06-13 21:24:40 +00:00
parent 74e0d96695
commit cd653a3266
4 changed files with 25 additions and 9 deletions

View File

@@ -4115,7 +4115,13 @@ static int flattenSubquery(
if( isLeftJoin>0 ){
sqlite3SetJoinExpr(pWhere, iNewParent);
}
pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
if( pWhere ){
if( pParent->pWhere ){
pParent->pWhere = sqlite3PExpr(pParse, TK_AND, pWhere, pParent->pWhere);
}else{
pParent->pWhere = pWhere;
}
}
if( db->mallocFailed==0 ){
SubstContext x;
x.pParse = pParse;