From: drh Date: Thu, 8 Apr 2010 15:00:59 +0000 (+0000) Subject: Fix the computation of the number of rows in a table during automatic X-Git-Tag: version-3.7.2~485 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bd5412b90c8dcdd052ed9179b8cc4aad4b36d00;p=thirdparty%2Fsqlite.git Fix the computation of the number of rows in a table during automatic index generation. FossilOrigin-Name: edeab06a5010c82491a6cc9393cf2a35a7622ac5 --- diff --git a/manifest b/manifest index 2cfccb019f..1082fd5ef6 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\san\sinteger\soverflow\sbug\sin\sthe\sautomatic\sindex\slogic.\s\sThe\sbug\swas\ndetected\sby\sthe\stestcase()\smacros\sadded\sin\sthe\sprevious\scheck-in.\s\sAlso\nadd\ssome\smore\stestcase()\smacros,\ssince\sthis\sissue\spoints\sup\stheir\simportance. -D 2010-04-08T14:38:52 +C Fix\sthe\scomputation\sof\sthe\snumber\sof\srows\sin\sa\stable\sduring\sautomatic\nindex\sgeneration. +D 2010-04-08T15:01:00 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -225,7 +225,7 @@ F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 15a4eef6bce7cf1bbf482c9e17b108d0b7a92a82 +F src/where.c 93621d17d920f88eddd1128c9d24a580d3d3186e F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45 @@ -799,14 +799,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 7286547847721b8f5f64bc2e7dc236652b1ae985 -R 96a8069556b5a410b2e431cd978a7df7 +P af97b4881a8f010055cde672634141d7ed6898fc +R 189f525b453ffe6645c72e74e5753384 U drh -Z d04d44898ea5b97de880f4d4839621a4 +Z 120eeaf33e13295b22c77bafcc4479fd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLveqAoxKgR168RlERAg5iAJ9bvCC1ncZeGw9njwB9ke6HucmE9gCePKdl -9wmrvenH+dOO2hKdhlCA+O0= -=pW+N +iD8DBQFLve+voxKgR168RlERAu90AJ9LihyzApsQCmIA/Se27rrzZ3urCgCfZ9Ei +GvxJaneZawJ1mUfT4w2pFAE= +=6WQF -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 259efecd49..2024eafaaa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af97b4881a8f010055cde672634141d7ed6898fc \ No newline at end of file +edeab06a5010c82491a6cc9393cf2a35a7622ac5 \ No newline at end of file diff --git a/src/where.c b/src/where.c index a90f8c740d..dbb1f3f395 100644 --- a/src/where.c +++ b/src/where.c @@ -1695,7 +1695,8 @@ static void bestAutomaticIndex( } assert( pParse->nQueryLoop >= (double)1 ); - nTableRow = pSrc->pIndex ? pSrc->pIndex->aiRowEst[0] : 1000000; + pTable = pSrc->pTab; + nTableRow = pTable->pIndex ? pTable->pIndex->aiRowEst[0] : 1000000; logN = estLog(nTableRow); costTempIdx = 2*logN*(nTableRow/pParse->nQueryLoop + 1); if( costTempIdx>=pCost->rCost ){ @@ -1705,7 +1706,6 @@ static void bestAutomaticIndex( } /* Search for any equality comparison term */ - pTable = pSrc->pTab; pWCEnd = &pWC->a[pWC->nTerm]; for(pTerm=pWC->a; pTerm