SQLite

Check-in [dc7be158b8]
Login

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

Overview
Comment:Fix an OOM-recovery problem in the DELETE code generator.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | optimize-delete
Files: files | file ages | folders
SHA1: dc7be158b82ab9156d0fcdf3394f881eac4d23c3
User & Date: drh 2013-11-16 23:03:06.762
Context
2013-11-16
23:16
Fix a couple of minor problems with the new delete logic. (check-in: a11243f840 user: drh tags: optimize-delete)
23:03
Fix an OOM-recovery problem in the DELETE code generator. (check-in: dc7be158b8 user: drh tags: optimize-delete)
22:48
Combine the rowid and WITHOUT ROWID paths for DELETE into a single path. (check-in: c4734b881a user: drh tags: optimize-delete)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/delete.c.
429
430
431
432
433
434
435
436



437
438
439
440
441
442
443
    if( okOnePass ){
      /* For ONEPASS, no need to store the rowid/primary-key.  There is only
      ** one, so just keep it in its register(s) and fall through to the
      ** delete code.
      */
      nKey = nPk; /* OP_Found will use an unpacked key */
      aToOpen = sqlite3DbMallocRaw(db, nIdx+2);
      if( aToOpen==0 ) goto delete_from_cleanup;



      memset(aToOpen, 1, nIdx+1);
      aToOpen[nIdx+1] = 0;
      if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;
      if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;
      if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);
      addrDelete = sqlite3VdbeAddOp0(v, OP_Goto); /* Jump to DELETE logic */
    }else if( pPk ){







|
>
>
>







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
    if( okOnePass ){
      /* For ONEPASS, no need to store the rowid/primary-key.  There is only
      ** one, so just keep it in its register(s) and fall through to the
      ** delete code.
      */
      nKey = nPk; /* OP_Found will use an unpacked key */
      aToOpen = sqlite3DbMallocRaw(db, nIdx+2);
      if( aToOpen==0 ){
        sqlite3WhereEnd(pWInfo);
        goto delete_from_cleanup;
      }
      memset(aToOpen, 1, nIdx+1);
      aToOpen[nIdx+1] = 0;
      if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;
      if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;
      if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);
      addrDelete = sqlite3VdbeAddOp0(v, OP_Goto); /* Jump to DELETE logic */
    }else if( pPk ){