1
0
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:
drh
2017-01-04 22:02:56 +00:00
parent 4e1f0efb4d
commit 801f55d837
3 changed files with 22 additions and 19 deletions

View File

@@ -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);