SQLite

Check-in [9991626b25]
Login

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

Overview
Comment:Do not use the insert-overwrite optimization if the cell might overwrite the page header.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | branch-3.29
Files: files | file ages | folders
SHA3-256: 9991626b25ad5cc782d8de0b5b4522bccbe13256772742c9031aa824c5293522
User & Date: drh 2019-07-22 23:30:44.176
Context
2019-07-22
23:30
Do not use the insert-overwrite optimization if the cell might overwrite the page header. (Leaf check-in: 9991626b25 user: drh tags: branch-3.29)
23:24
Do not use the insert-overwrite optimization if the cell might overwrite the page header. (check-in: f60a830691 user: drh tags: trunk)
2019-07-19
01:25
Fix a new problem in the BETWEEN operator when applied to a window function. The problem was introduced yesterday by check-in [7ef7b23cbb1b9ace]. This cherry-pick also needed to remove an assert from sqliteExprDelete(). (check-in: ce6bf395e2 user: drh tags: branch-3.29)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
8725
8726
8727
8728
8729
8730
8731



8732


8733
8734
8735
8736
8737
8738
8739
      ** doing that is no faster then skipping this optimization and just
      ** calling dropCell() and insertCell(). 
      **
      ** This optimization cannot be used on an autovacuum database if the
      ** new entry uses overflow pages, as the insertCell() call below is
      ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry.  */
      assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */



      if( oldCell+szNew > pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;


      memcpy(oldCell, newCell, szNew);
      return SQLITE_OK;
    }
    dropCell(pPage, idx, info.nSize, &rc);
    if( rc ) goto end_insert;
  }else if( loc<0 && pPage->nCell>0 ){
    assert( pPage->leaf );







>
>
>
|
>
>







8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
      ** doing that is no faster then skipping this optimization and just
      ** calling dropCell() and insertCell(). 
      **
      ** This optimization cannot be used on an autovacuum database if the
      ** new entry uses overflow pages, as the insertCell() call below is
      ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry.  */
      assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
      if( oldCell < pPage->aData+pPage->hdrOffset+10 ){
        return SQLITE_CORRUPT_BKPT;
      }
      if( oldCell+szNew > pPage->aDataEnd ){
        return SQLITE_CORRUPT_BKPT;
      }
      memcpy(oldCell, newCell, szNew);
      return SQLITE_OK;
    }
    dropCell(pPage, idx, info.nSize, &rc);
    if( rc ) goto end_insert;
  }else if( loc<0 && pPage->nCell>0 ){
    assert( pPage->leaf );