aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2019-05-08 11:52:13 +0000
committerdan <dan@noemail.net>2019-05-08 11:52:13 +0000
commita7be6f355c3e474b7da48ea5a7e7fcff6d6bed47 (patch)
tree628cd5de2f763585a77ef764266d5eef569d562b /src
parent291508f62b9906adf7be3058b296d56edcc5b01f (diff)
parent9edd8c11ab5f04ad052413f1b1be712e45a2d650 (diff)
downloadsqlite-a7be6f355c3e474b7da48ea5a7e7fcff6d6bed47.tar.gz
sqlite-a7be6f355c3e474b7da48ea5a7e7fcff6d6bed47.zip
Fix VDBE opcodes OP_SeekLT and OP_SeekLE so that they work on intkey tables with non-numeric text values.
FossilOrigin-Name: 658b84d7f4a0886591c5aab30ed9e31c4a0f56db303eb863f24833ca37085d14
Diffstat (limited to 'src')
-rw-r--r--src/vdbe.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vdbe.c b/src/vdbe.c
index 1fd49a931..fbcdca851 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4012,11 +4012,14 @@ case OP_SeekGT: { /* jump, in3, group */
** loss of information, then special processing is required... */
if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
if( (pIn3->flags & MEM_Real)==0 ){
- /* If the P3 value cannot be converted into any kind of a number,
- ** then the seek is not possible, so jump to P2 */
- VdbeBranchTaken(1,2); goto jump_to_p2;
- break;
- }
+ if( (pIn3->flags & MEM_Null) || oc>=OP_SeekGE ){
+ VdbeBranchTaken(1,2); goto jump_to_p2;
+ break;
+ }else{
+ sqlite3BtreeLast(pC->uc.pCursor, &res);
+ goto seek_not_found;
+ }
+ }else
/* If the approximation iKey is larger than the actual real search
** term, substitute >= for > and < for <=. e.g. if the search term
@@ -4040,7 +4043,7 @@ case OP_SeekGT: { /* jump, in3, group */
assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) );
if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;
}
- }
+ }
rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);
pC->movetoTarget = iKey; /* Used by OP_Delete */
if( rc!=SQLITE_OK ){