diff options
author | dan <dan@noemail.net> | 2018-09-24 14:51:59 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2018-09-24 14:51:59 +0000 |
commit | 2fae1504024f9f9f0b66b24f17e9c6c3ddca2062 (patch) | |
tree | 721fa79d0ca21521e864517d4cd8e936e90983f7 /src/expr.c | |
parent | 6314eeaeb3162173265b8ed316b61644b4fd7806 (diff) | |
download | sqlite-2fae1504024f9f9f0b66b24f17e9c6c3ddca2062.tar.gz sqlite-2fae1504024f9f9f0b66b24f17e9c6c3ddca2062.zip |
Fix a problem with views that use window functions as part of complex expressions.
FossilOrigin-Name: 507d892c3a40a0bacbd47ed3c4fe2d8925a82716ae08da8401750a42782ba454
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index fa0bcd86a..4d92ab8a1 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1270,17 +1270,14 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ } /* Fill in pNew->pLeft and pNew->pRight. */ + zAlloc += dupedExprNodeSize(p, dupFlags); if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){ - zAlloc += dupedExprNodeSize(p, dupFlags); if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){ pNew->pLeft = p->pLeft ? exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0; pNew->pRight = p->pRight ? exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0; } - if( pzBuffer ){ - *pzBuffer = zAlloc; - } }else{ #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ @@ -1299,6 +1296,9 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ pNew->pRight = sqlite3ExprDup(db, p->pRight, 0); } } + if( pzBuffer ){ + *pzBuffer = zAlloc; + } } return pNew; } |