diff options
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/insert.c b/src/insert.c index b3b8444f3..abc34c03c 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1233,6 +1233,7 @@ void sqlite3GenerateConstraintChecks( int ipkTop = 0; /* Top of the rowid change constraint check */ int ipkBottom = 0; /* Bottom of the rowid change constraint check */ u8 isUpdate; /* True if this is an UPDATE operation */ + int regRowid = -1; /* Register holding ROWID value */ isUpdate = regOldData!=0; db = pParse->db; @@ -1463,7 +1464,9 @@ void sqlite3GenerateConstraintChecks( int iField = pIdx->aiColumn[i]; int x; if( iField<0 || iField==pTab->iPKey ){ + if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ x = regNewData; + regRowid = pIdx->pPartIdxWhere ? -1 : regIdx+i; }else{ x = iField + regNewData + 1; } |