1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Fix some problems with foreign key processing within REPLACE ops on WITHOUT

ROWID tables with no triggers or auxiliary indexes.

FossilOrigin-Name: c1220b1af62629d7fc2178512786d613cd7ea711
This commit is contained in:
dan
2017-01-05 06:57:42 +00:00
parent 801f55d837
commit f9a12a106b
4 changed files with 74 additions and 9 deletions

View File

@@ -1554,12 +1554,15 @@ void sqlite3GenerateConstraintChecks(
** (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
** (5) No FK constraint counters need to be updated if a conflict occurs.
*/
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))
&& ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */
(0==pTab->pFKey && 0==sqlite3FkReferences(pTab)))
){
sqlite3VdbeResolveLabel(v, addrUniqueOk);
continue;