]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a problem computing affinities for indexes during skip-scan code
authordrh <drh@noemail.net>
Fri, 25 Sep 2015 01:09:27 +0000 (01:09 +0000)
committerdrh <drh@noemail.net>
Fri, 25 Sep 2015 01:09:27 +0000 (01:09 +0000)
generation when SQLITE_ENABLE_STAT4 is on.  Bug introduced by
check-in [1ee089a72d789002].

FossilOrigin-Name: 1350dd42d056508337b1a07ad8b1c9c97593f8d3

manifest
manifest.uuid
src/where.c

index e5079a39f30c2e8f8f5fefecf86ae8fa12a78565..e86f6aafd21810037e782fb32810d49c4967b138 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\sthe\squery\splanner\sso\sthat\sit\sis\sable\sto\suse\sindexed\sexpressions\nto\shelp\sfulfill\san\sORDER\sBY\sclause.
-D 2015-09-24T18:47:59.761
+C Fix\sa\sproblem\scomputing\saffinities\sfor\sindexes\sduring\sskip-scan\scode\s\ngeneration\swhen\sSQLITE_ENABLE_STAT4\sis\son.\s\sBug\sintroduced\sby\ncheck-in\s[1ee089a72d789002].
+D 2015-09-25T01:09:27.582
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e1afa6fb2de2bddd50e0ddae8166c2ee9d69b301
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -417,7 +417,7 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
 F src/wal.c 18b0ed49830cf04fe2d68224b41838a73ac6cd24
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba
-F src/where.c 278073aabce8d2020d30dff2edb6fe9430e1762c
+F src/where.c a7582b752d436d335bfb62f445e1c2771e7daa95
 F src/whereInt.h 7892bb54cf9ca0ae5c7e6094491b94c9286dc647
 F src/wherecode.c 7660e1ad16817a921b099af553f3e1349352d16f
 F src/whereexpr.c 2473e4350e30f9b55d1c6a8f66ca23c689f23f1d
@@ -1388,7 +1388,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 1c8c5380a8b45c9e04d9663c3cb8182ef3a61b81
-R 292146e62fe1cf1653fb27c4bd570968
+P 668fc1ebaf426f9eed3ed7865e41f1023dafebfb
+R e89f89bb659102a73737ed43d8a4eae7
 U drh
-Z 3832f12930eca538f34541b12960504f
+Z 28a6620004b61f128b9c9ee72c986f80
index 8bdf819c4fb9fbc36b11a1e623f120d19fe46ebd..1fe02891b6a1f2d9acce69741766ce275bed2801 100644 (file)
@@ -1 +1 @@
-668fc1ebaf426f9eed3ed7865e41f1023dafebfb
\ No newline at end of file
+1350dd42d056508337b1a07ad8b1c9c97593f8d3
\ No newline at end of file
index e6c7728c3a202eb3ea83183e925ba907da5547d0..6578900c1089db90e11348e58382bba29cf97d57 100644 (file)
@@ -1159,6 +1159,7 @@ static LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){
 ** Return the affinity for a single column of an index.
 */
 static char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){
+  assert( iCol>=0 && iCol<pIdx->nColumn );
   if( !pIdx->zColAff ){
     if( sqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB;
   }
@@ -1216,8 +1217,7 @@ static int whereRangeSkipScanEst(
   int nLower = -1;
   int nUpper = p->nSample+1;
   int rc = SQLITE_OK;
-  int iCol = p->aiColumn[nEq];
-  u8 aff = sqlite3IndexColumnAffinity(db, p, iCol);
+  u8 aff = sqlite3IndexColumnAffinity(db, p, nEq);
   CollSeq *pColl;
   
   sqlite3_value *p1 = 0;          /* Value extracted from pLower */