From: dan Date: Mon, 20 Jan 2014 19:55:33 +0000 (+0000) Subject: In where.c, do not allocate space in sqlite3_index_info structures for the internal... X-Git-Tag: version-3.8.3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a4ff825095456e0fe12dd4d9c848043fd6b91697;p=thirdparty%2Fsqlite.git In where.c, do not allocate space in sqlite3_index_info structures for the internal WHERE clause "terms" generated to record column equivalencies. FossilOrigin-Name: 7d9e22187daaa3160b875a1df17b924969bf718e --- diff --git a/manifest b/manifest index 23358e38e5..7c7eeb389c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Handle\sa\sfew\sobscure\sproblems\sthat\scould\smanifest\sif\sa\sdatabase\scorrupted\sin\sa\scertain\sway\swas\swritten\sby\sa\sconnection\sin\sthe\smiddle\sof\sa\sSELECT\sstatement\son\sthe\ssame\sdb. -D 2014-01-20T18:25:44.841 +C In\swhere.c,\sdo\snot\sallocate\sspace\sin\ssqlite3_index_info\sstructures\sfor\sthe\sinternal\sWHERE\sclause\s"terms"\sgenerated\sto\srecord\scolumn\sequivalencies. +D 2014-01-20T19:55:33.120 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -293,7 +293,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 5e11de480a94e6ff8f9922e3a04a31b56d5f33b5 +F src/where.c 56f85486bc8d0cb57fc15e5db2a58d1dfa1114cf F src/whereInt.h 96a75c61f1d2b9d4a8e4bb17d89deb0cf7cba358 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1027,7 +1027,7 @@ F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 F test/view.test 4057630287bfa5955628fe90a13d4c225d1c7352 -F test/vtab1.test 45ddde57764659c0ec90874bcb6c4831f1004c06 +F test/vtab1.test b631d147b198cfd7903ab5fed028eb2a3d321dc6 F test/vtab2.test 7bcffc050da5c68f4f312e49e443063e2d391c0d F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1 F test/vtab4.test 942f8b8280b3ea8a41dae20e7822d065ca1cb275 @@ -1152,7 +1152,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P a06235e0f6aa1e8fefa3f2873ee035eac9dac750 -R 05b4cba80caa92c648883df94b9ec5d5 +P eba8a564e62f84a9620008beead80081fe90a1b7 +R c774305f58a7e7fff71d714265811a28 U dan -Z 37a297a819c7d62ae4b0e647e3e25c85 +Z 8e05aa582afc8018a3754b6d40d97300 diff --git a/manifest.uuid b/manifest.uuid index ad1f20fbcf..1199189ccc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eba8a564e62f84a9620008beead80081fe90a1b7 \ No newline at end of file +7d9e22187daaa3160b875a1df17b924969bf718e \ No newline at end of file diff --git a/src/where.c b/src/where.c index 30c8597408..86376c4955 100644 --- a/src/where.c +++ b/src/where.c @@ -1751,7 +1751,8 @@ static sqlite3_index_info *allocateIndexInfo( assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); testcase( pTerm->eOperator & WO_IN ); testcase( pTerm->eOperator & WO_ISNULL ); - if( pTerm->eOperator & (WO_ISNULL) ) continue; + testcase( pTerm->eOperator & WO_ALL ); + if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; nTerm++; } @@ -1803,7 +1804,8 @@ static sqlite3_index_info *allocateIndexInfo( assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); testcase( pTerm->eOperator & WO_IN ); testcase( pTerm->eOperator & WO_ISNULL ); - if( pTerm->eOperator & (WO_ISNULL) ) continue; + testcase( pTerm->eOperator & WO_ALL ); + if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; pIdxCons[j].iColumn = pTerm->u.leftColumn; pIdxCons[j].iTermOffset = i; diff --git a/test/vtab1.test b/test/vtab1.test index 3eb37357d9..0542ee6fdd 100644 --- a/test/vtab1.test +++ b/test/vtab1.test @@ -1376,4 +1376,23 @@ do_execsql_test 20.4 { ORDER BY 1, 2; } {5 5 6 6 11 11 12 12} +#------------------------------------------------------------------------- +# +do_execsql_test 21.1 { + CREATE TABLE t9(a,b,c); + CREATE VIRTUAL TABLE t9v USING echo(t9); + + INSERT INTO t9 VALUES(1,2,3); + INSERT INTO t9 VALUES(3,2,1); + INSERT INTO t9 VALUES(2,2,2); +} + +do_execsql_test 21.2 { + SELECT * FROM t9v WHERE a