]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor fixes to the OR-clause processing in the NGQP.
authordrh <drh@noemail.net>
Sat, 11 May 2013 00:06:23 +0000 (00:06 +0000)
committerdrh <drh@noemail.net>
Sat, 11 May 2013 00:06:23 +0000 (00:06 +0000)
FossilOrigin-Name: d6946f33c7851aa7efb04b93ac2ae1ac50c26eec

manifest
manifest.uuid
src/where.c

index 5d695c8a7f8d5070e3643a73841ab4ec2ea0d5ab..53d49f8c0caee574ccdb9403da99b2817e8c614d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Now\sgenerating\sOR-clause\splans.
-D 2013-05-10T20:26:22.071
+C Minor\sfixes\sto\sthe\sOR-clause\sprocessing\sin\sthe\sNGQP.
+D 2013-05-11T00:06:23.252
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ce81671efd6223d19d4c8c6b88ac2c4134427111
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -264,7 +264,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 374f50ced988b23addabd3c351f1c18d8652d394
+F src/where.c 049e7011b90717768eed37cdbe912d85f66a395b
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -1062,7 +1062,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 586b55d8d7722de1c0530b3b832bae0511e6d05c
-R a9f14f7930497f93900a124a55885f20
+P e17003fcfec0c0b524b1b9ff8e15e7ee83efa571
+R eb646fd2ea7876f6a2dea69031e80ca3
 U drh
-Z 9615c6567bc86000a51d8e76292d6ef0
+Z cf78dc58c7e86082569e8dd0f46801e5
index 250be9516250d3c4c8523f5a601c75d5a66c7e91..be800b411f03485e0445b2b889c5feca47c87a5e 100644 (file)
@@ -1 +1 @@
-e17003fcfec0c0b524b1b9ff8e15e7ee83efa571
\ No newline at end of file
+d6946f33c7851aa7efb04b93ac2ae1ac50c26eec
\ No newline at end of file
index fdadc3e7387e7ceacb841abf77a8bf8265edb51e..d0a3fce772946b870d0c9626e255005192e94e33 100644 (file)
@@ -5337,8 +5337,9 @@ static int whereLoopAddBtreeIndex(
 }
 
 /*
-** Add all WhereLoop objects for the iTab-th table of the join.  That
-** table is guaranteed to be a b-tree table, not a virtual table.
+** Add all WhereLoop objects a single table of the join were the table
+** is idenfied by pBuilder->pNew->iTab.  That table is guaranteed to be
+** a b-tree table, not a virtual table.
 */
 static int whereLoopAddBtree(
   WhereLoopBuilder *pBuilder, /* WHERE clause information */
@@ -5356,6 +5357,7 @@ static int whereLoopAddBtree(
 
   pNew = pBuilder->pNew;
   pSrc = pBuilder->pTabList->a + pNew->iTab;
+  assert( !IsVirtual(pSrc->pTab) );
 
   if( pSrc->pIndex ){
     /* An INDEXED BY clause specifies a particular index to use */
@@ -5454,8 +5456,8 @@ static int whereLoopAddBtree(
 }
 
 /*
-** Add all WhereLoop objects for the iTab-th table of the join.  That
-** table is guaranteed to be a virtual table.
+** Add all WhereLoop objects for a table of the join identified by
+** pBuilder->pNew->iTab.  That table is guaranteed to be a virtual table.
 */
 static int whereLoopAddVirtual(
   WhereLoopBuilder *pBuilder,  /* WHERE clause information */
@@ -5484,6 +5486,7 @@ static int whereLoopAddVirtual(
   pNew = pBuilder->pNew;
   pSrc = &pBuilder->pTabList->a[pNew->iTab];
   pTab = pSrc->pTab;
+  assert( IsVirtual(pTab) );
   pIdxInfo = allocateIndexInfo(pParse, pWC, pSrc, pBuilder->pOrderBy);
   if( pIdxInfo==0 ) return SQLITE_NOMEM;
   pNew->prereq = 0;
@@ -5493,7 +5496,7 @@ static int whereLoopAddVirtual(
   pNew->u.vtab.needFree = 0;
   pUsage = pIdxInfo->aConstraintUsage;
 
-  for(iPhase=0; iPhase<=2; iPhase++){
+  for(iPhase=0; iPhase<=3; iPhase++){
     if( !seenIn && (iPhase&1)!=0 ){
       iPhase++;
       if( iPhase>3 ) break;
@@ -5540,11 +5543,11 @@ static int whereLoopAddVirtual(
     if( rc ) goto whereLoopAddVtab_exit;
     pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
     pNew->prereq = 0;
-    assert( pIdxInfo->nConstraint<=pBuilder->mxTerm );
-    for(i=0; i<pIdxInfo->nConstraint; i++) pNew->aTerm[i] = 0;
     mxTerm = -1;
+    for(i=0; i<pBuilder->mxTerm; i++) pNew->aTerm[i] = 0;
     for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
       if( (iTerm = pUsage[i].argvIndex - 1)>=0 ){
+        if( iTerm>=pBuilder->mxTerm ) break;
         j = pIdxCons->iTermOffset;
         if( iTerm>=pIdxInfo->nConstraint
          || j<0