diff options
author | dan <Dan Kennedy> | 2021-01-27 17:15:06 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2021-01-27 17:15:06 +0000 |
commit | df1b52e72795ad08fc1b80027f3d4fbe6be408c4 (patch) | |
tree | 81efa4af58c3d7e191188739a20f747ca0699ba5 /src/wherecode.c | |
parent | e5ceaac446d11372cd4b20cd5d9033a8e868c66a (diff) | |
download | sqlite-df1b52e72795ad08fc1b80027f3d4fbe6be408c4.tar.gz sqlite-df1b52e72795ad08fc1b80027f3d4fbe6be408c4.zip |
Ensure a cursor used by the SeekScan operator does not point to a valid row on the first iteration of the loop. Possible fix for [2d6e8400].
FossilOrigin-Name: 390cf60a286b13f454429f4652a133f95a7891a75c1ec6d16cd39990590fd3fb
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 4afe0ac9c..17dc36152 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1743,6 +1743,12 @@ Bitmask sqlite3WhereCodeOneLoopStart( SWAP(u8, nBtm, nTop); } + if( iLevel>0 && (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){ + /* In case OP_SeekScan is used, ensure that the index cursor does not + ** point to a valid row for the first iteration of this loop. */ + sqlite3VdbeAddOp1(v, OP_NullRow, iIdxCur); + } + /* Generate code to evaluate all constraint terms using == or IN ** and store the values of those terms in an array of registers ** starting at regBase. |