/ Check-in [bc7d2c16]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem with the fix for [9cf6c9bb51] (commit [658b84d7]) that could cause a cursor to be left in an invalid state following a (rowid < text-value) search.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bc7d2c1656396bb4f5f1f814e60dbf816cc91c5a521b54ad593cd3da0fe8dcb4
User & Date: dan 2019-05-14 20:25:22
Context
2019-05-15
10:16
Simplify the "Verifying Code Authenticity" section of the README.md file. No code changes. check-in: adebffc1 user: drh tags: trunk
2019-05-14
22:25
Merge all the latest trunk enhancements into the reuse-schema branch. check-in: 018f3199 user: drh tags: reuse-schema
22:02
Merge the latest trunk enhancements into the wal2 branch. check-in: 23ec34e4 user: drh tags: wal2
21:51
Merge the latest trunk enhancements into begin-concurrent-pnu. check-in: e70878b3 user: drh tags: begin-concurrent-pnu
21:51
Merge the latest trunk enhancements into begin-concurrent. check-in: 5d3a6e18 user: drh tags: begin-concurrent
20:25
Fix a problem with the fix for [9cf6c9bb51] (commit [658b84d7]) that could cause a cursor to be left in an invalid state following a (rowid < text-value) search. check-in: bc7d2c16 user: dan tags: trunk
19:20
New test cases in test/fuzzdata8.db. check-in: 228e1087 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  3997   3997     oc = pOp->opcode;
  3998   3998     eqOnly = 0;
  3999   3999     pC->nullRow = 0;
  4000   4000   #ifdef SQLITE_DEBUG
  4001   4001     pC->seekOp = pOp->opcode;
  4002   4002   #endif
  4003   4003   
         4004  +  pC->deferredMoveto = 0;
         4005  +  pC->cacheStatus = CACHE_STALE;
  4004   4006     if( pC->isTable ){
  4005   4007       /* The BTREE_SEEK_EQ flag is only set on index cursors */
  4006   4008       assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0
  4007   4009                 || CORRUPT_DB );
  4008   4010   
  4009   4011       /* The input value in P3 might be of any type: integer, real, string,
  4010   4012       ** blob, or NULL.  But it needs to be an integer before we can do
................................................................................
  4101   4103         goto abort_due_to_error;
  4102   4104       }
  4103   4105       if( eqOnly && r.eqSeen==0 ){
  4104   4106         assert( res!=0 );
  4105   4107         goto seek_not_found;
  4106   4108       }
  4107   4109     }
  4108         -  pC->deferredMoveto = 0;
  4109         -  pC->cacheStatus = CACHE_STALE;
  4110   4110   #ifdef SQLITE_TEST
  4111   4111     sqlite3_search_count++;
  4112   4112   #endif
  4113   4113     if( oc>=OP_SeekGE ){  assert( oc==OP_SeekGE || oc==OP_SeekGT );
  4114   4114       if( res<0 || (res==0 && oc==OP_SeekGT) ){
  4115   4115         res = 0;
  4116   4116         rc = sqlite3BtreeNext(pC->uc.pCursor, 0);

Changes to test/rowid.test.

   760    760   do_execsql_test rowid-14.3 {
   761    761     DELETE FROM t14;
   762    762     SELECT * FROM t14 WHERE x < 'a' ORDER BY rowid ASC;
   763    763   } {}
   764    764   do_execsql_test rowid-14.4 {
   765    765     SELECT * FROM t14 WHERE x < 'a' ORDER BY rowid DESC;
   766    766   } {}
          767  +
          768  +reset_db
          769  +do_execsql_test rowid-15.0 {
          770  +  PRAGMA reverse_unordered_selects=true;
          771  +  CREATE TABLE t1 (c0, c1);
          772  +  CREATE TABLE t2 (c0 INT UNIQUE);
          773  +  INSERT INTO t1(c0, c1) VALUES (0, 0), (0, NULL);
          774  +  INSERT INTO t2(c0) VALUES (1);
          775  +}
          776  +
          777  +do_execsql_test rowid-15.1 {
          778  +  SELECT t2.c0, t1.c1 FROM t1, t2 
          779  +  WHERE (t2.rowid <= 'a') OR (t1.c0 <= t2.c0) LIMIT 100
          780  +} {1 {} 1 0}
          781  +
          782  +do_execsql_test rowid-15.2 {
          783  +  SELECT 1, NULL INTERSECT SELECT * FROM (
          784  +      SELECT t2.c0, t1.c1 FROM t1, t2
          785  +      WHERE ((t2.rowid <= 'a')) OR (t1.c0 <= t2.c0) ORDER BY 'a' DESC LIMIT 100
          786  +  );
          787  +} {1 {}}
          788  +
   767    789   
   768    790   finish_test