aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--test/fkey2.test92
3 files changed, 99 insertions, 7 deletions
diff --git a/manifest b/manifest
index 658d170ba..2b150606e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C i\ni\nMinor\schanges\sto\schecksum\srelated\stest\scases.
-D 2010-05-29T06:18:55
+C Add\stests\sto\sfkey2.test\sto\scheck\sthat\sON\sCONFLICT\sclauses\sdo\snot\saffect\sSQLite's\sbehaviour\swhen\san\sFK\sconstraint\sis\sviolated.
+D 2010-05-29T08:40:38
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -350,7 +350,7 @@ F test/expr.test 9f521ae22f00e074959f72ce2e55d46b9ed23f68
F test/filectrl.test 8923a6dc7630f31c8a9dd3d3d740aa0922df7bf8
F test/filefmt.test 84e3d0fe9f12d0d2ac852465c6f8450aea0d6f43
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
-F test/fkey2.test 4369be5ef6262187af326a0767a50e63f160f1cf
+F test/fkey2.test 098c06c139a79f690301a43511cd1f6420ae5433
F test/fkey3.test 42f88d6048d8dc079e2a8cf7baad1cc1483a7620
F test/fkey_malloc.test a5ede29bd2f6e56dea78c3d43fb86dd696c068c8
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
@@ -815,7 +815,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 778d0c1768f73057be912793631e0cf0575858fb
-R 3de33148905a50194902720ee6b775bd
+P 60c22bde52121993d4bea11eef38ab285c737e2c
+R 132966a7c0563e76b2849379585e861e
U dan
-Z b74577b9b52063fe6c9dd6e69ac9a2e9
+Z 9c5f2213670b38101b8556211a758e4d
diff --git a/manifest.uuid b/manifest.uuid
index 689008420..5bfdadacf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-60c22bde52121993d4bea11eef38ab285c737e2c \ No newline at end of file
+e9e5b1001986348ef0f88c19de87b94559a5451e \ No newline at end of file
diff --git a/test/fkey2.test b/test/fkey2.test
index acbc51601..c530e9f74 100644
--- a/test/fkey2.test
+++ b/test/fkey2.test
@@ -74,6 +74,9 @@ ifcapable {!foreignkey||!trigger} {
# fkey2-18.*: Test that the authorization callback is invoked when processing
# FK constraints.
#
+# fkey2-20.*: Test that ON CONFLICT clauses specified as part of statements
+# do not affect the operation of FK constraints.
+#
# fkey2-genfkey.*: Tests that were used with the shell tool .genfkey
# command. Recycled to test the built-in implementation.
#
@@ -1627,6 +1630,95 @@ do_test fkey2-19.4 {
sqlite3_finalize $S
} {SQLITE_OK}
+drop_all_tables
+do_test fkey2-20.1 {
+ execsql {
+ CREATE TABLE pp(a PRIMARY KEY, b);
+ CREATE TABLE cc(c PRIMARY KEY, d REFERENCES pp);
+ }
+} {}
+
+foreach {tn insert} {
+ 1 "INSERT"
+ 2 "INSERT OR IGNORE"
+ 3 "INSERT OR ABORT"
+ 4 "INSERT OR ROLLBACK"
+ 5 "INSERT OR REPLACE"
+ 6 "INSERT OR FAIL"
+} {
+ do_test fkey2-20.2.$tn.1 {
+ catchsql "$insert INTO cc VALUES(1, 2)"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.2.$tn.2 {
+ execsql { SELECT * FROM cc }
+ } {}
+ do_test fkey2-20.2.$tn.3 {
+ execsql {
+ BEGIN;
+ INSERT INTO pp VALUES(2, 'two');
+ INSERT INTO cc VALUES(1, 2);
+ }
+ catchsql "$insert INTO cc VALUES(3, 4)"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.2.$tn.4 {
+ execsql { COMMIT ; SELECT * FROM cc }
+ } {1 2}
+ do_test fkey2-20.2.$tn.5 {
+ execsql { DELETE FROM cc ; DELETE FROM pp }
+ } {}
+}
+
+foreach {tn update} {
+ 1 "UPDATE"
+ 2 "UPDATE OR IGNORE"
+ 3 "UPDATE OR ABORT"
+ 4 "UPDATE OR ROLLBACK"
+ 5 "UPDATE OR REPLACE"
+ 6 "UPDATE OR FAIL"
+} {
+ do_test fkey2-20.3.$tn.1 {
+ execsql {
+ INSERT INTO pp VALUES(2, 'two');
+ INSERT INTO cc VALUES(1, 2);
+ }
+ } {}
+ do_test fkey2-20.3.$tn.2 {
+ catchsql "$update pp SET a = 1"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.3.$tn.3 {
+ execsql { SELECT * FROM pp }
+ } {2 two}
+ do_test fkey2-20.3.$tn.4 {
+ catchsql "$update cc SET d = 1"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.3.$tn.5 {
+ execsql { SELECT * FROM cc }
+ } {1 2}
+ do_test fkey2-20.3.$tn.6 {
+ execsql {
+ BEGIN;
+ INSERT INTO pp VALUES(3, 'three');
+ }
+ catchsql "$update pp SET a = 1 WHERE a = 2"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.3.$tn.7 {
+ execsql { COMMIT ; SELECT * FROM pp }
+ } {2 two 3 three}
+ do_test fkey2-20.3.$tn.8 {
+ execsql {
+ BEGIN;
+ INSERT INTO cc VALUES(2, 2);
+ }
+ catchsql "$update cc SET d = 1 WHERE c = 1"
+ } {1 {foreign key constraint failed}}
+ do_test fkey2-20.3.$tn.9 {
+ execsql { COMMIT ; SELECT * FROM cc }
+ } {1 2 2 2}
+ do_test fkey2-20.3.$tn.10 {
+ execsql { DELETE FROM cc ; DELETE FROM pp }
+ } {}
+}
+
#-------------------------------------------------------------------------
# The following block of tests, those prefixed with "fkey2-genfkey.", are
# the same tests that were used to test the ".genfkey" command provided