1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Minor changes and coverge tests for "SELECT count(*)" optimization. (CVS 6324)

FossilOrigin-Name: a3695b98f63fb776c3b7f77f0553e8a38bcc6f78
This commit is contained in:
danielk1977
2009-02-25 08:56:47 +00:00
parent 11b57d6929
commit 02f33725d2
5 changed files with 73 additions and 15 deletions

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.503 2009/02/24 18:33:15 danielk1977 Exp $
** $Id: select.c,v 1.504 2009/02/25 08:56:47 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -2975,10 +2975,11 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
){
return 0;
}
pTab = p->pSrc->a[0].pTab;
pExpr = p->pEList->a[0].pExpr;
if( !pTab || pTab->pSelect || IsVirtual(pTab) ) return 0;
assert( pTab && !pTab->pSelect && pExpr );
if( IsVirtual(pTab) ) return 0;
if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0;
if( pExpr->flags&EP_Distinct ) return 0;