/ Check-in [6f7d9995]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 | SQL 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
Context
2015-03-24
19:43
Update this branch with latest trunk changes. check-in: 3ccd64ef user: dan tags: insert-select-opt
2015-03-23
14:39
Set the OPFLAG_SEEKRESULT correctly in "INSERT INTO ... SELECT" statements. check-in: 6f7d9995 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: 93e28ea1 user: dan tags: insert-select-opt
Changes
Hide Diffs Unified Diffs 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);
    }