SQLite

Check-in [9d057f5221]
Login

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

Overview
Comment:Fix a database corruption bug caused by the ONEPASS optimization added in check-in [8b93cc5937000535]. Bug detected (prior to release) by sqllogictest. Test cases to follow.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d057f52217e7ef9c3f3eb84117abe3365503f44
User & Date: drh 2015-09-28 14:40:20.768
Context
2015-09-28
15:08
Add test cases to the ONEPASS optimization corruption problem fixed by the previous check-in. (check-in: 5c14d44705 user: drh tags: trunk)
14:40
Fix a database corruption bug caused by the ONEPASS optimization added in check-in [8b93cc5937000535]. Bug detected (prior to release) by sqllogictest. Test cases to follow. (check-in: 9d057f5221 user: drh tags: trunk)
2015-09-26
17:44
Enable adding JSON1 by appending the json1.c source file to the amalgamation and compiling with -DSQLITE_ENABLE_JSON1 (check-in: 33404b2029 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
4525
4526
4527
4528
4529
4530
4531


4532

4533
4534
4535
4536
4537
4538
4539
    ** reference the index.
    */
    if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){
      pIdx = pLoop->u.btree.pIndex;
    }else if( pLoop->wsFlags & WHERE_MULTI_OR ){
      pIdx = pLevel->u.pCovidx;
    }


    if( pIdx && !db->mallocFailed ){

      last = sqlite3VdbeCurrentAddr(v);
      k = pLevel->addrBody;
      pOp = sqlite3VdbeGetOp(v, k);
      for(; k<last; k++, pOp++){
        if( pOp->p1!=pLevel->iTabCur ) continue;
        if( pOp->opcode==OP_Column ){
          int x = pOp->p2;







>
>
|
>







4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
    ** reference the index.
    */
    if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){
      pIdx = pLoop->u.btree.pIndex;
    }else if( pLoop->wsFlags & WHERE_MULTI_OR ){
      pIdx = pLevel->u.pCovidx;
    }
    if( pIdx
     && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))
     && !db->mallocFailed
    ){
      last = sqlite3VdbeCurrentAddr(v);
      k = pLevel->addrBody;
      pOp = sqlite3VdbeGetOp(v, k);
      for(; k<last; k++, pOp++){
        if( pOp->p1!=pLevel->iTabCur ) continue;
        if( pOp->opcode==OP_Column ){
          int x = pOp->p2;