mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Increase test coverage of where.c. Make sure OR-optimization works on
UPDATE and DELETE in addition to SELECT. (Bug found by coverage tests.) (CVS 6139) FossilOrigin-Name: 4b2c08e8984befb12fa2173ca89d9f54cf764d22
This commit is contained in:
23
src/where.c
23
src/where.c
@@ -16,7 +16,7 @@
|
||||
** so is applicable. Because this module is responsible for selecting
|
||||
** indices, you might also think of this module as the "query optimizer".
|
||||
**
|
||||
** $Id: where.c,v 1.359 2009/01/07 20:58:57 drh Exp $
|
||||
** $Id: where.c,v 1.360 2009/01/08 03:11:19 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -2719,6 +2719,8 @@ static Bitmask codeOneLoopStart(
|
||||
/* sqlite3ReleaseTempReg(pParse, regOrRowset); // Preserve the RowSet */
|
||||
pLevel->op = OP_Goto;
|
||||
pLevel->p2 = addrCont;
|
||||
}else{
|
||||
pLevel->op = OP_Noop;
|
||||
}
|
||||
disableTerm(pLevel, pTerm);
|
||||
}else
|
||||
@@ -3128,15 +3130,16 @@ WhereInfo *sqlite3WhereBegin(
|
||||
** Return an error.
|
||||
*/
|
||||
pIdx = pTabList->a[bestJ].pIndex;
|
||||
assert( !pIdx
|
||||
|| (bestPlan.plan.wsFlags&WHERE_INDEXED)==0
|
||||
|| pIdx==bestPlan.plan.u.pIdx );
|
||||
if( pIdx
|
||||
&& ((bestPlan.plan.wsFlags & WHERE_INDEXED)==0
|
||||
|| bestPlan.plan.u.pIdx!=pIdx)
|
||||
){
|
||||
sqlite3ErrorMsg(pParse, "cannot use index: %s", pIdx->zName);
|
||||
goto whereBeginError;
|
||||
if( pIdx ){
|
||||
if( (bestPlan.plan.wsFlags & WHERE_INDEXED)==0 ){
|
||||
sqlite3ErrorMsg(pParse, "cannot use index: %s", pIdx->zName);
|
||||
goto whereBeginError;
|
||||
}else{
|
||||
/* If an INDEXED BY clause is used, the bestIndex() function is
|
||||
** guaranteed to find the index specified in the INDEXED BY clause
|
||||
** if it find an index at all. */
|
||||
assert( bestPlan.plan.u.pIdx==pIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
WHERETRACE(("*** Optimizer Finished ***\n"));
|
||||
|
||||
Reference in New Issue
Block a user