From: drh Date: Fri, 8 Apr 2011 23:04:28 +0000 (+0000) Subject: Make sure the left-hand side of the IS NOT NULL operator is a simple column X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ecd2c060252cfff6198c3b0d4cfb8792bf75c597;p=thirdparty%2Fsqlite.git Make sure the left-hand side of the IS NOT NULL operator is a simple column and not a general expression before applying the IS NOT NULL optimization. This is a backport of check-in [543f75a6abe3]. FossilOrigin-Name: e8177e0149280ea775e9aac18307ce2528f72298 --- diff --git a/manifest b/manifest index 59380976d4..4441069be6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Provide\shints\sto\sthe\sbtree\slayer\sNext\sand\sPrevious\sprimitives\sto\slet\sthem\s\nknow\sif\sthey\scan\sbe\sno-ops\sif\sthe\sunderlying\sindex\sis\sunique. -D 2011-03-31T18:36:17.545 +C Make\ssure\sthe\sleft-hand\sside\sof\sthe\sIS\sNOT\sNULL\soperator\sis\sa\ssimple\scolumn\nand\snot\sa\sgeneral\sexpression\sbefore\sapplying\sthe\sIS\sNOT\sNULL\noptimization.\s\sThis\sis\sa\sbackport\sof\scheck-in\s[543f75a6abe3]. +D 2011-04-08T23:04:28.400 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -230,7 +230,7 @@ F src/vtab.c 0e8e0cb30dffb078367e843e84e37ef99236c7e4 F src/wal.c 5ac2119e23ee4424599d4275b66dc88d612a0543 F src/wal.h 96669b645e27cd5a111ba59f0cae7743a207bc3c F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 51e6657e2d585dfced4c195d6faefe4738d4f1f9 +F src/where.c 6a465e780bbf065f54438b73b6b12dfb73a26d7e F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce @@ -822,7 +822,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/lemon.c fe890e2d8d2db1e3f57e2a22503dbb0f6843e517 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309 -F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x +F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c.tcl aff0d53f0e84cf919922c0d02e767bdf5eeafb90 F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b @@ -847,7 +847,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 68daf20d019a0a84764d635a91eaa9faeeabbab4 -R 360abc8fb9d546a9c24f3a762ab15633 +P a5aae1743a208e7792497dfebf3e8311140ae595 +R e7d63c16d3e7d724e83cf507d108ae6c U drh -Z 7d66317f7caf97967841a7d087fe3ae8 +Z 1d910069d892bc78b9a0e115530a1c05 diff --git a/manifest.uuid b/manifest.uuid index 56463fcf48..5b024ee698 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a5aae1743a208e7792497dfebf3e8311140ae595 \ No newline at end of file +e8177e0149280ea775e9aac18307ce2528f72298 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 83b9ed3595..ec04b3d4af 100644 --- a/src/where.c +++ b/src/where.c @@ -1343,7 +1343,10 @@ static void exprAnalyze( ** of the loop. Without the TERM_VNULL flag, the not-null check at ** the start of the loop will prevent any results from being returned. */ - if( pExpr->op==TK_NOTNULL && pExpr->pLeft->iColumn>=0 ){ + if( pExpr->op==TK_NOTNULL + && pExpr->pLeft->op==TK_COLUMN + && pExpr->pLeft->iColumn>=0 + ){ Expr *pNewExpr; Expr *pLeft = pExpr->pLeft; int idxNew; diff --git a/tool/mkopts.tcl b/tool/mkopts.tcl old mode 100755 new mode 100644