mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Fix the query plan for an indexed lookup on a WITHOUT ROWID table with
a DESC primary key when the primary key is constrained by an inequality. See [forum:/forumpost/8988341615|forum post 8988341615]. Test cases in TH3. FossilOrigin-Name: f65c929bf189cf5ca5f1cacdbbb8eec014c9960f767b135023bd2323cd26f279
This commit is contained in:
@@ -1749,8 +1749,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
** a forward order scan on a descending index, interchange the
|
||||
** start and end terms (pRangeStart and pRangeEnd).
|
||||
*/
|
||||
if( (nEq<pIdx->nKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))
|
||||
|| (bRev && pIdx->nKeyCol==nEq)
|
||||
if( (nEq<pIdx->nColumn && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))
|
||||
|| (bRev && pIdx->nColumn==nEq)
|
||||
){
|
||||
SWAP(WhereTerm *, pRangeEnd, pRangeStart);
|
||||
SWAP(u8, bSeekPastNull, bStopAtNull);
|
||||
|
||||
Reference in New Issue
Block a user