SQLite

Check-in [6f7d999585]
Login

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

Overview
Comment:Set the OPFLAG_SEEKRESULT correctly in "INSERT INTO ... SELECT" statements.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | insert-select-opt
Files: files | file ages | folders
SHA1: 6f7d9995855bb5ae6dfe75c08a532b26808988b3
User & Date: dan 2015-03-23 14:39:19.308
Context
2015-03-24
19:43
Update this branch with latest trunk changes. (check-in: 3ccd64eff7 user: dan tags: insert-select-opt)
2015-03-23
14:39
Set the OPFLAG_SEEKRESULT correctly in "INSERT INTO ... SELECT" statements. (check-in: 6f7d999585 user: dan tags: insert-select-opt)
2015-03-21
15:26
Do not use sorters for INSERT statements that insert multiple rows using the VALUES clause. (check-in: 93e28ea1ef user: dan tags: insert-select-opt)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/insert.c.
1067
1068
1069
1070
1071
1072
1073

1074
1075
1076
1077
1078
1079
1080
        if( oe!=OE_None ){
          int nField = -1 * pIdx->nKeyCol;
          int jmp = sqlite3VdbeCurrentAddr(v)+2;
          sqlite3VdbeAddOp4Int(v, OP_NoConflict, iIdx, jmp, iTmp, nField);
          sqlite3UniqueConstraint(pParse, oe, pIdx);
        }
        sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, iTmp); 

        sqlite3VdbeAddOp2(v, OP_SorterNext, iCur, addr+1); VdbeCoverage(v);
        sqlite3VdbeJumpHere(v, addr);
        sqlite3VdbeAddOp1(v, OP_Close, iCur);
      }
      sqlite3ReleaseTempReg(pParse, iTmp);
    }








>







1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
        if( oe!=OE_None ){
          int nField = -1 * pIdx->nKeyCol;
          int jmp = sqlite3VdbeCurrentAddr(v)+2;
          sqlite3VdbeAddOp4Int(v, OP_NoConflict, iIdx, jmp, iTmp, nField);
          sqlite3UniqueConstraint(pParse, oe, pIdx);
        }
        sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, iTmp); 
        if( oe!=OE_None ) sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
        sqlite3VdbeAddOp2(v, OP_SorterNext, iCur, addr+1); VdbeCoverage(v);
        sqlite3VdbeJumpHere(v, addr);
        sqlite3VdbeAddOp1(v, OP_Close, iCur);
      }
      sqlite3ReleaseTempReg(pParse, iTmp);
    }