From: drh Date: Fri, 31 May 2013 11:57:39 +0000 (+0000) Subject: Fix the constructAutomaticIndex() routine so that it works with NGQP. X-Git-Tag: version-3.8.0~130^2~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53b52f7f2e0ba540f52727f5c84aabff8fbb1ef9;p=thirdparty%2Fsqlite.git Fix the constructAutomaticIndex() routine so that it works with NGQP. FossilOrigin-Name: 5e1e61399513b4a95fd93df2377a2603f1670063 --- diff --git a/manifest b/manifest index f227274658..dbb58ea9b3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\sORDER\sBY\ssuppressor\sin\sthe\sNGQP. -D 2013-05-30T23:21:20.132 +C Fix\sthe\sconstructAutomaticIndex()\sroutine\sso\sthat\sit\sworks\swith\sNGQP. +D 2013-05-31T11:57:39.405 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83 F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73 -F src/where.c 38beadcfdf477b0f9a07c4d0a479ab522843b14c +F src/where.c 530dd22d4f803747e964edcb052d699c4c92e1a1 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6 @@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P a51d8c92496436488e1a6eabd85785e8fedf2736 -R 405146591851ecbfbac166e3c1b2db18 +P 24a2e9ddcecd3926817d77abbb75d068ee7140ad +R 92deaa75392a3f586cae6bde8f65a470 U drh -Z 4964f74ab7b0cf98172fb87fb30a1333 +Z 293d3cdab228aa747c73a2994c326e63 diff --git a/manifest.uuid b/manifest.uuid index ee070b19f5..57b2c0e51a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -24a2e9ddcecd3926817d77abbb75d068ee7140ad \ No newline at end of file +5e1e61399513b4a95fd93df2377a2603f1670063 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 9d454bc80c..dea0ff2fdd 100644 --- a/src/where.c +++ b/src/where.c @@ -1850,6 +1850,7 @@ static void constructAutomaticIndex( WhereLoop *pLoop; /* The Loop object */ Bitmask idxCols; /* Bitmap of columns used for indexing */ Bitmask extraCols; /* Bitmap of additional columns */ + const int mxConstraint = 10; /* Maximum number of constraints */ /* Generate code to skip over the creation and initialization of the ** transient index on 2nd and subsequent iterations of the loop. */ @@ -1864,20 +1865,25 @@ static void constructAutomaticIndex( pWCEnd = &pWC->a[pWC->nTerm]; pLoop = pLevel->pWLoop; idxCols = 0; - for(pTerm=pWC->a; pTermaTerm = sqlite3DbRealloc(pParse->db, pLoop->aTerm, + mxConstraint*sizeof(pLoop->aTerm[0])); + if( pLoop->aTerm==0 ) return; + for(pTerm=pWC->a; pTermnTermu.leftColumn; Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<aTerm[nColumn++] = pTerm; idxCols |= cMask; } } } assert( nColumn>0 ); - pLoop->u.btree.nEq = nColumn; + pLoop->u.btree.nEq = pLoop->nTerm = nColumn; + pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED + | WHERE_TEMP_INDEX; /* Count the number of additional columns needed to create a ** covering index. A "covering index" is an index that contains all