diff options
-rw-r--r-- | manifest | 16 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/expr.c | 25 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/whereexpr.c | 12 |
5 files changed, 31 insertions, 28 deletions
@@ -1,5 +1,5 @@ -C Take\scare\swhen\schecking\sthe\stable\sof\sa\sTK_COLUMN\sexpression\snode\sto\ssee\sif\sthe\ntable\sis\sa\svirtual\stable\sto\sfirst\sensure\sthat\sthe\sExpr.y.pTab\spointer\sis\snot\nnull\sdue\sto\sgenerated\scolumn\soptimizations.\s\sTicket\s[4374860b29383380]. -D 2020-02-17T00:12:04.817 +C A\sbetter\s(smaller\sand\sfaster)\ssolution\sto\sticket\s[4374860b29383380]. +D 2020-02-17T19:25:07.592 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -483,7 +483,7 @@ F src/date.c 6c408fdd2e9ddf6e8431aba76315a2d061bea2cec8fbb75e25d7c1ba08274712 F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a F src/dbstat.c 0f55297469d4244ab7df395849e1af98eb5e95816af7c661e7d2d8402dea23da F src/delete.c 11000121c4281c0bce4e41db29addfaea0038eaa127ece02557c9207bc3e541d -F src/expr.c af70e9a131624dac1c482dd6ed4f73df24a905987447ec8f70a17c7ee55dd2d7 +F src/expr.c 4b25db7f9472b3532560242193bc4eefaefc7720dc4f2d7ec9a89ada410c6ea2 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 4b575423b0a5d4898b1a7868ce985cf1a8ad91c741c9abbb108ff02536d20f41 F src/func.c 108577cebe8a50c86d849a93b99493a54e348dd0b846f00d13b52ca973d5baf4 @@ -536,7 +536,7 @@ F src/shell.c.in c2e20c43a44fb5588a6c27ce60589538fbf4794fd7686f5b2598eca22eaae1f F src/sqlite.h.in 0d9ef312509cb7c8445f4dc25fedfe103c147668a78a36a607a1064f1e0612a4 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 27951f294f29cd875c6027f2707d644ef99f469bd97514568b5a8581a114db8c -F src/sqliteInt.h a8979f41b823f4bc8ee0c446f5a9190074a14570fd4022194a7299c453f3c00c +F src/sqliteInt.h d736043dc6291d3af289d911237da0801b6c05be086ae322eedd47a089ae8d2f F src/sqliteLimit.h 95cb8479ca459496d9c1c6a9f76b38aee12203a56ce1092fe13e50ae2454c032 F src/status.c 9ff2210207c6c3b4d9631a8241a7d45ab1b26a0e9c84cb07a9b5ce2de9a3b278 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 @@ -620,7 +620,7 @@ F src/walker.c a137468bf36c92e64d2275caa80c83902e3a0fc59273591b96c6416d3253d05d F src/where.c cbad14f1d8e11b9f052e937274315c7c17266a89eda408c86084ee894debb7d5 F src/whereInt.h 9157228db086f436a574589f8cc5749bd971e94017c552305ad9ec472ed2e098 F src/wherecode.c f5df56e395ade2240cabb2d39500c681bd29f8cc0636c3301c4996ad160df94d -F src/whereexpr.c 512b6d4b0c5710d45ec4efeec19523c457b86d47bb9f02e582d2ee47b423aa2e +F src/whereexpr.c 264d58971eaf8256eb5b0917bcd7fc7a1f1109fdda183a8382308a1b18a2dce7 F src/window.c f8ba2ee12a19b51d3ba42c16277c74185ee9215306bc0d5a03974ade8b5bc98f F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627 @@ -1858,7 +1858,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 109ee07433b274a39954cef62bf67d47bcda960df9bef56127210ebf1c3c104c -R 6f9ad25842fa66c90901a82d5cd39115 +P 9d0d4ab95dc0c56e053c2924ed322a9ea7b25439e6f74599f706905a1994e454 +R 1c052b7cdf4947664b7043564b643ac3 U drh -Z 68fbba6154ce295a8c685f40a10cb886 +Z e960557a43b001a47933dacf8bc1d10e diff --git a/manifest.uuid b/manifest.uuid index abd4568ad..26c2328b5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9d0d4ab95dc0c56e053c2924ed322a9ea7b25439e6f74599f706905a1994e454
\ No newline at end of file +abc473fb8fb999005dc79a360e34f97b3b25429decf1820dd2afa5c19577753d
\ No newline at end of file diff --git a/src/expr.c b/src/expr.c index be23a5bd5..8b939de24 100644 --- a/src/expr.c +++ b/src/expr.c @@ -2245,15 +2245,6 @@ int sqlite3ExprIsInteger(Expr *p, int *pValue){ } /* -** Return true if p is a Column node that references a virtual table. -*/ -int sqlite3ExprIsVtabRef(Expr *p){ - if( p->op!=TK_COLUMN ) return 0; - if( p->y.pTab==0 ) return 0; - return IsVirtual(p->y.pTab); -} - -/* ** Return FALSE if there is no chance that the expression can be NULL. ** ** If the expression might be NULL or if the expression is too complex @@ -5481,19 +5472,25 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ case TK_LT: case TK_LE: case TK_GT: - case TK_GE: + case TK_GE: { + Expr *pLeft = pExpr->pLeft; + Expr *pRight = pExpr->pRight; testcase( pExpr->op==TK_EQ ); testcase( pExpr->op==TK_NE ); testcase( pExpr->op==TK_LT ); testcase( pExpr->op==TK_LE ); testcase( pExpr->op==TK_GT ); testcase( pExpr->op==TK_GE ); - if( sqlite3ExprIsVtabRef(pExpr->pLeft) - || sqlite3ExprIsVtabRef(pExpr->pRight) + /* The y.pTab=0 assignment in wherecode.c always happens after the + ** impliesNotNullRow() test */ + if( (pLeft->op==TK_COLUMN && ALWAYS(pLeft->y.pTab!=0) + && IsVirtual(pLeft->y.pTab)) + || (pRight->op==TK_COLUMN && ALWAYS(pRight->y.pTab!=0) + && IsVirtual(pRight->y.pTab)) ){ - return WRC_Prune; + return WRC_Prune; } - + } default: return WRC_Continue; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c42a9e8c6..517bb40b8 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2153,8 +2153,11 @@ struct Table { */ #ifndef SQLITE_OMIT_VIRTUALTABLE # define IsVirtual(X) ((X)->nModuleArg) +# define ExprIsVtab(X) \ + ((X)->op==TK_COLUMN && (X)->y.pTab!=0 && (X)->y.pTab->nModuleArg) #else # define IsVirtual(X) 0 +# define ExprIsVtab(X) 0 #endif /* @@ -4278,7 +4281,6 @@ int sqlite3ExprIsTableConstant(Expr*,int); int sqlite3ExprContainsSubquery(Expr*); #endif int sqlite3ExprIsInteger(Expr*, int*); -int sqlite3ExprIsVtabRef(Expr*); int sqlite3ExprCanBeNull(const Expr*); int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); int sqlite3IsRowid(const char*); diff --git a/src/whereexpr.c b/src/whereexpr.c index e99a44f15..3c91fc353 100644 --- a/src/whereexpr.c +++ b/src/whereexpr.c @@ -377,7 +377,8 @@ static int isAuxiliaryVtabOperator( ** MATCH(expression,vtab_column) */ pCol = pList->a[1].pExpr; - if( sqlite3ExprIsVtabRef(pCol) ){ + testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 ); + if( ExprIsVtab(pCol) ){ for(i=0; i<ArraySize(aOp); i++){ if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){ *peOp2 = aOp[i].eOp2; @@ -399,7 +400,8 @@ static int isAuxiliaryVtabOperator( ** with function names in an arbitrary case. */ pCol = pList->a[0].pExpr; - if( sqlite3ExprIsVtabRef(pCol) ){ + testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 ); + if( ExprIsVtab(pCol) ){ sqlite3_vtab *pVtab; sqlite3_module *pMod; void (*xNotUsed)(sqlite3_context*,int,sqlite3_value**); @@ -422,10 +424,12 @@ static int isAuxiliaryVtabOperator( int res = 0; Expr *pLeft = pExpr->pLeft; Expr *pRight = pExpr->pRight; - if( sqlite3ExprIsVtabRef(pLeft) ){ + testcase( pLeft->op==TK_COLUMN && pLeft->y.pTab==0 ); + if( ExprIsVtab(pLeft) ){ res++; } - if( pRight && sqlite3ExprIsVtabRef(pRight) ){ + testcase( pRight && pRight->op==TK_COLUMN && pRight->y.pTab==0 ); + if( pRight && ExprIsVtab(pRight) ){ res++; SWAP(Expr*, pLeft, pRight); } |