1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

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
This commit is contained in:
drh
2020-10-02 02:02:18 +00:00
parent d7d406e81c
commit 4ad1a1c74c
4 changed files with 30 additions and 12 deletions

View File

@@ -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