diff options
author | drh <drh@noemail.net> | 2020-10-02 02:02:18 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-10-02 02:02:18 +0000 |
commit | 4ad1a1c74caeee76124091e6e1771fae4afa1a33 (patch) | |
tree | 7cb1b588fee1a6dda1bb24896f2c235dbefef7e1 /src | |
parent | d7d406e81cb9fa9bf78fa6f435646943a00bc612 (diff) | |
download | sqlite-4ad1a1c74caeee76124091e6e1771fae4afa1a33.tar.gz sqlite-4ad1a1c74caeee76124091e6e1771fae4afa1a33.zip |
Disable the OP_SeekScan opcode of the in-scan-vs-index optimization when
in PRAGMA reverse_unordered_selects mode, as the OP_SeekScan only works
with forwards scans. Thanks to OSSFuzz for pointing out the problem to
us.
FossilOrigin-Name: c75c3a3b756635bfdab44e4b56a337e4a88af3a8803cd3e9a67abf3d0d3450dc
Diffstat (limited to 'src')
-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 |