]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the constructAutomaticIndex() routine so that it works with NGQP.
authordrh <drh@noemail.net>
Fri, 31 May 2013 11:57:39 +0000 (11:57 +0000)
committerdrh <drh@noemail.net>
Fri, 31 May 2013 11:57:39 +0000 (11:57 +0000)
FossilOrigin-Name: 5e1e61399513b4a95fd93df2377a2603f1670063

manifest
manifest.uuid
src/where.c

index f227274658a850b54e34b87109114d9d739120be..dbb58ea9b3ea8209894e398a2452b6751ec7ba23 100644 (file)
--- 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
index ee070b19f506dad30bf5e32993beda62709d229a..57b2c0e51a09175cac33fcc589fbd38d059905b0 100644 (file)
@@ -1 +1 @@
-24a2e9ddcecd3926817d77abbb75d068ee7140ad
\ No newline at end of file
+5e1e61399513b4a95fd93df2377a2603f1670063
\ No newline at end of file
index 9d454bc80c19e126e63724e01486458c585398b2..dea0ff2fdd2f463aa4ab58b3af91c71e02cf5075 100644 (file)
@@ -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; pTerm<pWCEnd; pTerm++){
+  pLoop->aTerm = sqlite3DbRealloc(pParse->db, pLoop->aTerm,
+                                  mxConstraint*sizeof(pLoop->aTerm[0]));
+  if( pLoop->aTerm==0 ) return;
+  for(pTerm=pWC->a; pTerm<pWCEnd && pLoop->nTerm<mxConstraint; pTerm++){
     if( termCanDriveIndex(pTerm, pSrc, notReady) ){
       int iCol = pTerm->u.leftColumn;
       Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;
       testcase( iCol==BMS );
       testcase( iCol==BMS-1 );
       if( (idxCols & cMask)==0 ){
-        nColumn++;
+        pLoop->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