]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Factor an invariant out the loop termination condition for the ORDER BY
authordrh <drh@noemail.net>
Tue, 2 Oct 2012 01:46:48 +0000 (01:46 +0000)
committerdrh <drh@noemail.net>
Tue, 2 Oct 2012 01:46:48 +0000 (01:46 +0000)
satisfied-by-index analyzer routine.

FossilOrigin-Name: 545bb33688663066cf3f09e4cdc4d5cfe59fb8db

manifest
manifest.uuid
src/where.c

index f2a8ebb39a072406bc1f56ca866b2d1d0696da1a..0d1e3cf201b1f9e0b626c858d218edf312bdfc4d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\ssure\sthe\souter\sloop\scursor\snumbers\sare\srecorded\sin\stime\sfor\sthem\sto\sbe\nused\sby\sthe\sORDER\sBY\soptimizer.
-D 2012-10-02T01:25:16.426
+C Factor\san\sinvariant\sout\sthe\sloop\stermination\scondition\sfor\sthe\sORDER\sBY\nsatisfied-by-index\sanalyzer\sroutine.
+D 2012-10-02T01:46:48.203
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -249,7 +249,7 @@ F src/vtab.c d8020c0a0e8ccc490ca449d7e665311b6e9f3ba9
 F src/wal.c e1fe8f92a0ea0fef8faa87ec43a127a478589d22
 F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
 F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
-F src/where.c 0a309f52e9ca5e77250a242c2f0527754e3e30c4
+F src/where.c 58a99bf57e1e216210fa143f3ae3cd1a5928a36f
 F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 0be144b453e0622a085fae8665c32f5676708e00
@@ -1018,7 +1018,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P 76b277655646a9fe0f336ff106157f1efcd32019
-R 8e3740840a007142381cf2f0396df8e5
+P 351dc8d9cab8a222f28fb865d3a7d1c622d60d6f
+R e2343532e1485c60fb209fa3ba6a8cc6
 U drh
-Z 2be46057d17778455d3bb7f9393d3220
+Z 8f9278868782471bac046c34faf9fbb1
index 53d466cfe9d07c9e0d236635c7c610e44a307e6f..bd7521b1fccd1a1d95f714a2398e5360cc9d5b72 100644 (file)
@@ -1 +1 @@
-351dc8d9cab8a222f28fb865d3a7d1c622d60d6f
\ No newline at end of file
+545bb33688663066cf3f09e4cdc4d5cfe59fb8db
\ No newline at end of file
index 739222338e00f3cfad00267c7970e30cf7368495..77f9fb2b7c43a6dbb591a890ced521c03d266f99 100644 (file)
@@ -2859,7 +2859,7 @@ static int isSortingIndex(
   ** of the index is also allowed to match against the ORDER BY
   ** clause.
   */
-  for(i=0,j=nPriorSat,pTerm=&pOrderBy->a[j]; j<nTerm && i<=pIdx->nColumn; i++){
+  for(i=0,j=nPriorSat,pTerm=&pOrderBy->a[j]; j<nTerm; i++){
     Expr *pExpr;       /* The expression of the ORDER BY pTerm */
     CollSeq *pColl;    /* The collating sequence of pExpr */
     int termSortOrder; /* Sort order for this term */
@@ -2867,6 +2867,7 @@ static int isSortingIndex(
     int iSortOrder;    /* 1 for DESC, 0 for ASC on the i-th index term */
     const char *zColl; /* Name of the collating sequence for i-th index term */
 
+    assert( i<=pIdx->nColumn );
     pExpr = pTerm->pExpr;
     if( pExpr->op!=TK_COLUMN || pExpr->iTable!=base ){
       /* Can not use an index sort on anything that is not a column in the