mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Improved the comment on the block of code the provides the performance
optimization originally added by check-in [925840cfdb]. The original check-in omitted condition 4, which was the cause of bug [30027b613b]. FossilOrigin-Name: c6506b82aa6583ccde5f673c79526d5f3920b67a
This commit is contained in:
22
src/insert.c
22
src/insert.c
@@ -1549,16 +1549,22 @@ void sqlite3GenerateConstraintChecks(
|
||||
onError = OE_Abort;
|
||||
}
|
||||
|
||||
if( ix==0 && pPk==pIdx && onError==OE_Replace && pPk->pNext==0 ){
|
||||
if( 0==(db->flags&SQLITE_RecTriggers)
|
||||
|| 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0)
|
||||
){
|
||||
sqlite3VdbeResolveLabel(v, addrUniqueOk);
|
||||
continue;
|
||||
}
|
||||
/* Collision detection may be omitted if all of the following are true:
|
||||
** (1) The conflict resolution algorithm is REPLACE
|
||||
** (2) The table is a WITHOUT ROWID table
|
||||
** (3) There are no secondary indexes on the table
|
||||
** (4) No delete triggers need to be fired if there is a conflict
|
||||
*/
|
||||
if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
|
||||
&& pPk==pIdx /* Condition 2 */
|
||||
&& onError==OE_Replace /* Condition 1 */
|
||||
&& ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */
|
||||
0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0))
|
||||
){
|
||||
sqlite3VdbeResolveLabel(v, addrUniqueOk);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Check to see if the new index entry will be unique */
|
||||
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
|
||||
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
|
||||
|
||||
Reference in New Issue
Block a user