-C Set\sand\sclear\sthe\sfull_column_name\sflag\susing\sdirect\sinvocation\srather\sthan\nthe\sexecsql\stcl\scommand\sso\sthat\sthe\sselect1\stest\sworks\swith\sthe\sserialized\nstatement\sextension.\s(CVS\s3136)
-D 2006-03-14T13:10:43
+C Fix\sCHECK\sconstraints\sto\suse\salternative\sconflict\sresolution.\s\sTicket\s#1717.\s(CVS\s3137)
+D 2006-03-15T16:26:10
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/func.c ea1a4480bacfb17f8e08d675313f024fe7136c00
F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
-F src/insert.c 2b0eb1f7d50b1d94782bac9644b41a53cf65c019
+F src/insert.c 1ae4b8ff5549497808e1b57b9243abcb599fd02f
F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390
F src/main.c 631ad93d030f0cef159eb98be173cdd472c5d3b0
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F test/capi3.test 6553fb89a4d6918e42b5f953c1d880bacb6917fe
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/cast.test f88e7b6946e9a467cf4bb142d92bb65a83747fc2
-F test/check.test 55ad950d7ad24d6eb3328c54149f90d38a39a962
+F test/check.test 46c658566c2501faa3f91b941654119703da1f83
F test/collate1.test add9454cef160677bb8b34148b8f277ce7f9f1c4
F test/collate2.test 224a632ba04907c049804b08162efd234aa7871f
F test/collate3.test 947a77f5b8227e037a7094d0e338a5504f155cc4
F www/index-ex1-x-b.gif f9b1d85c3fa2435cf38b15970c7e3aa1edae23a3
F www/index.tcl 9c659eec487d5e9196d4125ab200cfc86e93528d
F www/indirect1b1.gif adfca361d2df59e34f9c5cac52a670c2bfc303a1
-F www/lang.tcl 53a3643fe8a1f2397a0be00527eb26e4c801c0ae
+F www/lang.tcl 9fe2b8bb0a3158f4b629e184f5db9f895ecbb4cd
F www/lockingv3.tcl f59b19d6c8920a931f096699d6faaf61c05db55f
F www/mingw.tcl d96b451568c5d28545fefe0c80bee3431c73f69c
F www/nulls.tcl ec35193f92485b87b90a994a01d0171b58823fcf
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P f07181739f82b0d23f934f51b97e67c32efe6f42
-R 2f1c4b3a9a42e21655f80f86a32ab92a
+P 4d70013a6a42a58bc7af3a87bf79c131a0070e96
+R 21ca7022b824f24e0d9e1adce9350a21
U drh
-Z f9b20f77c14e1ce189c3b40b91bc6cce
+Z 3a90d1df6d7d6a018bd1a142c92b17e6
-4d70013a6a42a58bc7af3a87bf79c131a0070e96
\ No newline at end of file
+c0d20fa97f94313e6b7ee5b4baa236ef5b664d76
\ No newline at end of file
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.163 2006/03/06 20:55:46 drh Exp $
+** $Id: insert.c,v 1.164 2006/03/15 16:26:10 drh Exp $
*/
#include "sqliteInt.h"
sqlite3ExprIfTrue(pParse, pTab->pCheck, allOk, 1);
assert( pParse->ckOffset==nCol );
pParse->ckOffset = 0;
- sqlite3VdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort);
+ onError = overrideError!=OE_Default ? overrideError : OE_Abort;
+ if( onError==OE_Ignore || onError==OE_Replace ){
+ sqlite3VdbeAddOp(v, OP_Pop, nCol+1+hasTwoRowids, 0);
+ sqlite3VdbeAddOp(v, OP_Goto, 0, ignoreDest);
+ }else{
+ sqlite3VdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
+ }
sqlite3VdbeResolveLabel(v, allOk);
}
#endif /* !defined(SQLITE_OMIT_CHECK) */
# This file implements regression tests for SQLite library. The
# focus of this file is testing CHECK constraints
#
-# $Id: check.test,v 1.8 2006/01/17 09:35:02 danielk1977 Exp $
+# $Id: check.test,v 1.9 2006/03/15 16:26:10 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1 {parameters prohibited in CHECK constraints}}
+do_test check-6.1 {
+ execsql {SELECT * FROM t1}
+} {4 11.0}
+do_test check-6.2 {
+ execsql {
+ UPDATE OR IGNORE t1 SET x=5;
+ SELECT * FROM t1;
+ }
+} {4 11.0}
+do_test check-6.3 {
+ execsql {
+ INSERT OR IGNORE INTO t1 VALUES(5,4.0);
+ SELECT * FROM t1;
+ }
+} {4 11.0}
+do_test check-6.4 {
+ execsql {
+ INSERT OR IGNORE INTO t1 VALUES(2,20.0);
+ SELECT * FROM t1;
+ }
+} {4 11.0 2 20.0}
+do_test check-6.5 {
+ catchsql {
+ UPDATE OR FAIL t1 SET x=7-x, y=y+1;
+ }
+} {1 {constraint failed}}
+do_test check-6.6 {
+ execsql {
+ SELECT * FROM t1;
+ }
+} {3 12.0 2 20.0}
+do_test check-6.7 {
+ catchsql {
+ BEGIN;
+ INSERT INTO t1 VALUES(1,30.0);
+ INSERT OR ROLLBACK INTO t1 VALUES(8,40.0);
+ }
+} {1 {constraint failed}}
+do_test check-6.8 {
+ catchsql {
+ COMMIT;
+ }
+} {1 {cannot commit - no transaction is active}}
+do_test check-6.9 {
+ execsql {
+ SELECT * FROM t1
+ }
+} {3 12.0 2 20.0}
+
finish_test
#
# Run this Tcl script to generate the lang-*.html files.
#
-set rcsid {$Id: lang.tcl,v 1.110 2006/02/15 17:30:31 drh Exp $}
+set rcsid {$Id: lang.tcl,v 1.111 2006/03/15 16:26:10 drh Exp $}
source common.tcl
if {[llength $argv]>0} {
The command continues executing normally. No error is returned.
If a NOT NULL constraint violation occurs, the NULL value is replaced
by the default value for that column. If the column has no default
-value, then the ABORT algorithm is used.</p>
+value, then the ABORT algorithm is used. If a CHECK constraint violation
+occurs then the IGNORE algorithm is used.</p>
<p>When this conflict resolution strategy deletes rows in order to
satisfy a constraint, it does not invoke delete triggers on those
-rows. But that may change in a future release.</p>
+rows. This behavior might change in a future release.</p>
</dl>
<p>The algorithm specified in the OR clause of a INSERT or UPDATE