diff options
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index f2f2c23de..21f644d07 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1808,8 +1808,12 @@ Bitmask sqlite3WhereCodeOneLoopStart( op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; assert( op!=0 ); - if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){ - assert( op==OP_SeekGE ); + assert( op==OP_SeekGE + || (pLoop->wsFlags & WHERE_IN_SEEKSCAN)==0 + || (db->flags & SQLITE_ReverseOrder)!=0 ); + if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 + && op==OP_SeekGE /* OP_SeekScan only does forward scans */ + ){ assert( regBignull==0 ); /* TUNING: The OP_SeekScan opcode seeks to reduce the number ** of expensive seek operations by replacing a single seek with |