aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-08-03 13:08:54 +0000
committerdrh <drh@noemail.net>2010-08-03 13:08:54 +0000
commit6dc84902320f2a95db97b6007d6ef838d2845f30 (patch)
tree8e369b56fc702324a9a758e4409e9afdeb95d276
parent9e5f10743df1743d32a4dc7146f1c6764842694f (diff)
downloadsqlite-6dc84902320f2a95db97b6007d6ef838d2845f30.tar.gz
sqlite-6dc84902320f2a95db97b6007d6ef838d2845f30.zip
Fix the REPLACE conflict resolution so that it falls back to ABORT when
a CHECK constraint fails. Ticket [c38baa3d969eab794]. FossilOrigin-Name: 4e157b774764b8bafc9fabb88decf54f178b5ff5
-rw-r--r--manifest20
-rw-r--r--manifest.uuid2
-rw-r--r--src/insert.c1
-rw-r--r--test/conflict.test22
4 files changed, 34 insertions, 11 deletions
diff --git a/manifest b/manifest
index ae902b3ab..239547c2e 100644
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Modify\swal2.test\sto\sdisable\stests\srequiring\sTCL\s8.5\sif\sthe\stest\sharness\sis\ncompiled\susing\sTCL\s8.4.
-D 2010-08-02T10:59:14
+C Fix\sthe\sREPLACE\sconflict\sresolution\sso\sthat\sit\sfalls\sback\sto\sABORT\swhen\na\sCHECK\sconstraint\sfails.\s\sTicket\s[c38baa3d969eab794].
+D 2010-08-03T13:08:55
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -133,7 +133,7 @@ F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
-F src/insert.c ba455ebb100283ccc5da03da3498fcbca48ce6bb
+F src/insert.c a4995747c062256582a90b4f87f716e11b067050
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
@@ -304,7 +304,7 @@ F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a
F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
F test/colmeta.test 087c42997754b8c648819832241daf724f813322
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
-F test/conflict.test 0ed68b11f22721052d880ee80bd528a0e0828236
+F test/conflict.test f2f2b2950730a9532e11e468070cebf389f5c375
F test/corrupt.test 1a5bef8b2d178859af69814ecedcd37219a89968
F test/corrupt2.test 808a28d0ca3b97e9aa8c91cd2b485ea2700b76d1
F test/corrupt3.test a399dacccb91c732f6b071c913e70d195af8c058
@@ -844,14 +844,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P e75b52d156905ce16bedb94f65c01a4640bdfa75
-R 4bcc255fd245f0aefdffbbd0dcd527e2
+P 016486c7d544dcf9b7422cb0fb9804aa1c418f68
+R 3325483e922777e07054f0cb49438593
U drh
-Z 73dcbb237530d4b99c645ee151eb2169
+Z d4d184e312b9a6c1d14017f77666543c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFMVqUFoxKgR168RlERAr7YAJ4i7F11zp1UnFfAGpxICAppvxfFxwCfRCKv
-nCovMTlO5dRRYoRobLXqmLk=
-=2tPU
+iD8DBQFMWBTroxKgR168RlERAs2pAJ9ife269/S3Uo4Ju+ipuIdk7AK4VwCeNuGn
+CUQtoV3bUC+VGAu/OWy/3UA=
+=m2KU
-----END PGP SIGNATURE-----
diff --git a/manifest.uuid b/manifest.uuid
index 2f4c7c497..84f1cf5c8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-016486c7d544dcf9b7422cb0fb9804aa1c418f68 \ No newline at end of file
+4e157b774764b8bafc9fabb88decf54f178b5ff5 \ No newline at end of file
diff --git a/src/insert.c b/src/insert.c
index b8aa91b87..adf6ef2ed 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1220,6 +1220,7 @@ void sqlite3GenerateConstraintChecks(
if( onError==OE_Ignore ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
}else{
+ if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
sqlite3HaltConstraint(pParse, onError, 0, 0);
}
sqlite3VdbeResolveLabel(v, allOk);
diff --git a/test/conflict.test b/test/conflict.test
index 44390d20f..c612e3b3f 100644
--- a/test/conflict.test
+++ b/test/conflict.test
@@ -789,4 +789,26 @@ do_test conflict-12.4 {
} {2 one}
+# Ticket [c38baa3d969eab7946dc50ba9d9b4f0057a19437]
+# REPLACE works like ABORT on a CHECK constraint.
+#
+do_test conflict-13.1 {
+ execsql {
+ CREATE TABLE t13(a CHECK(a!=2));
+ BEGIN;
+ REPLACE INTO t13 VALUES(1);
+ }
+ catchsql {
+ REPLACE INTO t13 VALUES(2);
+ }
+} {1 {constraint failed}}
+do_test conflict-13.2 {
+ execsql {
+ REPLACE INTO t13 VALUES(3);
+ COMMIT;
+ SELECT * FROM t13;
+ }
+} {1 3}
+
+
finish_test