aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-10-10 13:29:15 +0000
committerdrh <drh@noemail.net>2016-10-10 13:29:15 +0000
commit48590fcb37f6fba73a4eaaf1c234a37e971b91fb (patch)
tree8cb6f9e91d4b27088e7acdc55613c07fffcb8d76 /src/wherecode.c
parentea5e5f0b8923abf1bf29065001d718f61fa7bc5e (diff)
downloadsqlite-48590fcb37f6fba73a4eaaf1c234a37e971b91fb.tar.gz
sqlite-48590fcb37f6fba73a4eaaf1c234a37e971b91fb.zip
Make sure indexes on expressions skip over initial NULL values in the
index. Fix for ticket [4baa464912129477f3c9] FossilOrigin-Name: 71797ba431085f9ae381ed5ea6471967926f4043
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index a244a303a..c095ce7c8 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1446,11 +1446,11 @@ Bitmask sqlite3WhereCodeOneLoopStart(
pLevel->iLikeRepCntr |= bRev ^ (pIdx->aSortOrder[nEq]==SQLITE_SO_DESC);
}
#endif
- if( pRangeStart==0
- && (j = pIdx->aiColumn[nEq])>=0
- && pIdx->pTable->aCol[j].notNull==0
- ){
- bSeekPastNull = 1;
+ if( pRangeStart==0 ){
+ j = pIdx->aiColumn[nEq];
+ if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){
+ bSeekPastNull = 1;
+ }
}
}
assert( pRangeEnd==0 || (pRangeEnd->wtFlags & TERM_VNULL)==0 );