The REPLACE conflict resolution falls back to FAIL when on a

CHECK constraint violation.  Ticket #2525. (CVS 4178)

FossilOrigin-Name: b213614abff90c65cc7228c87f4973150e8a9679
This commit is contained in:
drh 2007-07-23 19:39:46 +00:00
parent 95bdbbbd9e
commit 2e06c67c08
4 changed files with 32 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Move\sprototypes\sfor\sLEMON-generated\sparser\sfunctions\sinto\ssqliteInt.h.\nTicket\s#2521.\s(CVS\s4177)
D 2007-07-23T19:31:17
C The\sREPLACE\sconflict\sresolution\sfalls\sback\sto\sFAIL\swhen\son\sa\nCHECK\sconstraint\sviolation.\s\sTicket\s#2525.\s(CVS\s4178)
D 2007-07-23T19:39:47
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -81,7 +81,7 @@ F src/expr.c de9f55b1baed00199466028ad96967208d487798
F src/func.c dcba54fc18d2b2fd02f8b7c3dc13e27d100a4d8e
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
F src/insert.c 89d184422d85db0418e0f66032ccea3657078ecd
F src/insert.c ca135e919c2a9241e83e8dd74316677fdd54fb6f
F src/legacy.c 388c71ad7fbcd898ba1bcbfc98a3ac954bfa5d01
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
F src/loadext.c 6c24ee62adfe7fbfb2f2dd43ff18e5534b19010f
@ -194,7 +194,7 @@ F test/capi3.test 1cf80839d6224126acf82eb824308981fb054ef9
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/capi3c.test 76a3fb94755288a2977ee387e95305e6224c0198
F test/cast.test 0302bbc8d1be2f94da1e16ad2eb01ea356e26d18
F test/check.test e5ea0c1a06c10e81e3434ca029e2c4a562f2b673
F test/check.test 024ed399600b799160378cf9d9f436bdf5dfd184
F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
F test/collate2.test 701d9651c5707024fd86a20649af9ea55e2c0eb8
F test/collate3.test 947a77f5b8227e037a7094d0e338a5504f155cc4
@ -520,7 +520,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P b4a5c62b853f7a7d38863c39be274dccd2640944
R bb61dedb3e166418393c63c2982fb492
P bc02c7f1621ff46707f147c75f7e98462b01907f
R 2049a5db1d0bbd632d2230f714f15f27
U drh
Z 808a80e23d1f82302fa81879a5b9225c
Z 3942dc4034b0e9a4c4fc0fcd7bf61431

View File

@ -1 +1 @@
bc02c7f1621ff46707f147c75f7e98462b01907f
b213614abff90c65cc7228c87f4973150e8a9679

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.187 2007/06/26 10:38:55 danielk1977 Exp $
** $Id: insert.c,v 1.188 2007/07/23 19:39:47 drh Exp $
*/
#include "sqliteInt.h"
@ -1027,7 +1027,7 @@ void sqlite3GenerateConstraintChecks(
assert( pParse->ckOffset==nCol );
pParse->ckOffset = 0;
onError = overrideError!=OE_Default ? overrideError : OE_Abort;
if( onError==OE_Ignore || onError==OE_Replace ){
if( onError==OE_Ignore ){
sqlite3VdbeAddOp(v, OP_Pop, nCol+1+hasTwoRowids, 0);
sqlite3VdbeAddOp(v, OP_Goto, 0, ignoreDest);
}else{

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing CHECK constraints
#
# $Id: check.test,v 1.10 2006/06/20 11:01:09 danielk1977 Exp $
# $Id: check.test,v 1.11 2007/07/23 19:39:47 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -346,6 +346,27 @@ do_test check-6.9 {
}
} {3 12.0 2 20.0}
do_test check-6.11 {
execsql {SELECT * FROM t1}
} {3 12.0 2 20.0}
do_test check-6.12 {
catchsql {
REPLACE INTO t1 VALUES(6,7);
}
} {1 {constraint failed}}
do_test check-6.13 {
execsql {SELECT * FROM t1}
} {3 12.0 2 20.0}
do_test check-6.14 {
catchsql {
INSERT OR IGNORE INTO t1 VALUES(6,7);
}
} {0 {}}
do_test check-6.15 {
execsql {SELECT * FROM t1}
} {3 12.0 2 20.0}
}
finish_test