aboutsummaryrefslogtreecommitdiff
path: root/src/where.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-08-27 23:42:43 +0000
committerdrh <drh@noemail.net>2015-08-27 23:42:43 +0000
commit31a5d34283660f4438b51ff178c793fe1cb65c64 (patch)
tree6d9e7a3fba5ecc5cb6dc0e36a19e44a660d70430 /src/where.c
parentc7c4680ffd727443c81c4b926e518b2552275d3f (diff)
parent2dc292930d004c340eba968789148916f2b89cd4 (diff)
downloadsqlite-31a5d34283660f4438b51ff178c793fe1cb65c64.tar.gz
sqlite-31a5d34283660f4438b51ff178c793fe1cb65c64.zip
Fix the OR-optimization so that it always ignores subplans that do not use an index.
FossilOrigin-Name: cf452028d1be2c5578a07f6e21b4d8b613373eb8
Diffstat (limited to 'src/where.c')
-rw-r--r--src/where.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/where.c b/src/where.c
index 8d26cd4b4..ef92523a4 100644
--- a/src/where.c
+++ b/src/where.c
@@ -1948,18 +1948,20 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
** and prereqs.
*/
if( pBuilder->pOrSet!=0 ){
+ if( pTemplate->nLTerm ){
#if WHERETRACE_ENABLED
- u16 n = pBuilder->pOrSet->n;
- int x =
+ u16 n = pBuilder->pOrSet->n;
+ int x =
#endif
- whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun,
+ whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun,
pTemplate->nOut);
#if WHERETRACE_ENABLED /* 0x8 */
- if( sqlite3WhereTrace & 0x8 ){
- sqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n);
- whereLoopPrint(pTemplate, pBuilder->pWC);
- }
+ if( sqlite3WhereTrace & 0x8 ){
+ sqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n);
+ whereLoopPrint(pTemplate, pBuilder->pWC);
+ }
#endif
+ }
return SQLITE_OK;
}