From: drh Date: Mon, 24 Sep 2018 15:39:30 +0000 (+0000) Subject: Slightly smaller and faster alternative to [507d892c3a40a0bacbd47] that X-Git-Tag: version-3.26.0~129 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53988068894e24ff1bf7749b0efdb80be34fef78;p=thirdparty%2Fsqlite.git Slightly smaller and faster alternative to [507d892c3a40a0bacbd47] that fixes a problem with views that use window function as part of complex expressions. FossilOrigin-Name: d7c816ae15f05f21b9b213161e1044aaefc56f17e7bc4b7b551a9e04efc05855 --- diff --git a/manifest b/manifest index b8c0fc1b82..48b3191003 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sviews\sthat\suse\swindow\sfunctions\sas\spart\sof\scomplex\sexpressions. -D 2018-09-24T14:51:59.424 +C Slightly\ssmaller\sand\sfaster\salternative\sto\s[507d892c3a40a0bacbd47]\sthat\nfixes\sa\sproblem\swith\sviews\sthat\suse\swindow\sfunction\sas\spart\sof\scomplex\nexpressions. +D 2018-09-24T15:39:30.526 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -454,7 +454,7 @@ F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957 F src/dbpage.c 4aa7f26198934dbd002e69418220eae3dbc71b010bbac32bd78faf86b52ce6c3 F src/dbstat.c edabb82611143727511a45ca0859b8cd037851ebe756ae3db289859dd18b6f91 F src/delete.c 107e28d3ef8bd72fd11953374ca9107cd74e8b09c3ded076a6048742d26ce7d2 -F src/expr.c 781afe52002d84b6b8ae2873bbd2fd7825a8bc80e4e21333ab354c9c492bdb4a +F src/expr.c 5cee8fb79b1952689af80ed71ed16ad295f29d85de30c7592993b05cf1ec1e06 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 972a4ba14296bef2303a0abbad1e3d82bc3c61f9e6ce4e8e9528bdee68748812 F src/func.c 7c288b4ce309b5a8b8473514b88e1f8e69a80134509a8c0db8e39c858e367e7f @@ -1769,7 +1769,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5a38d9281b4ad63b853efa5cdd5ad4a64b19dfaf8250ef8e0e186684df1211ea -R 0305fb00a242bdc9e08655efd2c57d30 -U dan -Z e20c6e2011d089069671f2c306dc6b24 +P 507d892c3a40a0bacbd47ed3c4fe2d8925a82716ae08da8401750a42782ba454 +R c727b58cbf0dbd5e0c71bca27b5dfee5 +U drh +Z 5f623b5b79346b935df34b1ceb527a47 diff --git a/manifest.uuid b/manifest.uuid index 6052026b2a..593b4b1434 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -507d892c3a40a0bacbd47ed3c4fe2d8925a82716ae08da8401750a42782ba454 \ No newline at end of file +d7c816ae15f05f21b9b213161e1044aaefc56f17e7bc4b7b551a9e04efc05855 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 4d92ab8a1c..b2854f9a5d 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1270,21 +1270,24 @@ 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) ){ + if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly|EP_WinFunc) ){ + 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; } - }else{ #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ pNew->y.pWin = sqlite3WindowDup(db, pNew, p->y.pWin); assert( ExprHasProperty(pNew, EP_WinFunc) ); } #endif /* SQLITE_OMIT_WINDOWFUNC */ + if( pzBuffer ){ + *pzBuffer = zAlloc; + } + }else{ if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ if( pNew->op==TK_SELECT_COLUMN ){ pNew->pLeft = p->pLeft; @@ -1296,9 +1299,6 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ pNew->pRight = sqlite3ExprDup(db, p->pRight, 0); } } - if( pzBuffer ){ - *pzBuffer = zAlloc; - } } return pNew; }