aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <>2023-10-20 10:18:03 +0000
committerdrh <>2023-10-20 10:18:03 +0000
commitd707e012f06a82e293cba7ea97a5713db362fd08 (patch)
tree8bc638724ef61a56692da861e1bf869ad86b0e92 /src/expr.c
parentdcf76a8bbda9028c391945834d67471fc8e2821f (diff)
downloadsqlite-d707e012f06a82e293cba7ea97a5713db362fd08.tar.gz
sqlite-d707e012f06a82e293cba7ea97a5713db362fd08.zip
Use sqlite3ParserAddCleanup() instead of calling sqlite3ExprListDelete()
directly when disposing of an unused ORDER BY in an aggregate function, to avoid disrupting ALTER TABLE data structures. FossilOrigin-Name: d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c
index 86b5f5f1e..35c797ac8 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1223,7 +1223,9 @@ void sqlite3ExprAddFunctionOrderBy(
assert( ExprUseXList(pExpr) );
if( pExpr->x.pList==0 || NEVER(pExpr->x.pList->nExpr==0) ){
/* Ignore ORDER BY on zero-argument aggregates */
- sqlite3ExprListDelete(db, pOrderBy);
+ sqlite3ParserAddCleanup(pParse,
+ (void(*)(sqlite3*,void*))sqlite3ExprListDelete,
+ pOrderBy);
return;
}
if( IsWindowFunc(pExpr) ){