From: drh Date: Fri, 4 Oct 2013 00:00:12 +0000 (+0000) Subject: Make sure the count(*) optimization works correctly even when partial X-Git-Tag: version-3.8.1~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f33f375806d0856bb12002dc07d9f2766eaac35;p=thirdparty%2Fsqlite.git Make sure the count(*) optimization works correctly even when partial indices are present. Ticket [a5c8ed66cae]. FossilOrigin-Name: 9f2f4c0a50808910ad01c8c4352367f25747be08 --- diff --git a/manifest b/manifest index 69357054f1..5afa0d39ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sFTS\stake\sadvantage\sof\s"docidpIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->bUnordered==0 && (!pBest || pIdx->nColumnnColumn) ){ + if( pIdx->bUnordered==0 + && pIdx->pPartIdxWhere==0 + && (!pBest || pIdx->nColumnnColumn) + ){ pBest = pIdx; } } diff --git a/test/index6.test b/test/index6.test index 0b440451c1..c427dc3df3 100644 --- a/test/index6.test +++ b/test/index6.test @@ -37,6 +37,13 @@ do_test index6-1.1 { } } {14 20 ok} +# Make sure the count(*) optimization works correctly with +# partial indices. Ticket [a5c8ed66cae16243be6] 2013-10-03. +# +do_execsql_test index6-1.1.1 { + SELECT count(*) FROM t1; +} {20} + # Error conditions during parsing... # do_test index6-1.2 {