Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: third_party/sqlite/src/test/fkey1.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/filefmt.test ('k') | third_party/sqlite/src/test/fkey2.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/fkey1.test
diff --git a/third_party/sqlite/src/test/fkey1.test b/third_party/sqlite/src/test/fkey1.test
index e10781ac520c9cf8f1889613f82fd2f6e525cb0b..d9b038a02253ce3b844be361e730f2443ab2b24a 100644
--- a/third_party/sqlite/src/test/fkey1.test
+++ b/third_party/sqlite/src/test/fkey1.test
@@ -15,6 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set testprefix fkey1
ifcapable {!foreignkey} {
finish_test
@@ -185,4 +186,25 @@ do_catchsql_test fkey1-5.4 {
INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 3, 'A-2-3');
} {1 {FOREIGN KEY constraint failed}}
+#-------------------------------------------------------------------------
+# Check that foreign key processing is not fooled by partial indexes
+# on the parent table.
+#
+do_execsql_test 6.0 {
+ CREATE TABLE p1(x, y);
+ CREATE UNIQUE INDEX p1x ON p1(x) WHERE y<2;
+ INSERT INTO p1 VALUES(1, 1);
+ CREATE TABLE c1(a REFERENCES p1(x));
+}
+
+do_catchsql_test 6.1 {
+ INSERT INTO c1 VALUES(1);
+} {1 {foreign key mismatch - "c1" referencing "p1"}}
+
+do_execsql_test 6.2 {
+ CREATE UNIQUE INDEX p1x2 ON p1(x);
+ INSERT INTO c1 VALUES(1);
+} {}
+
+
finish_test
« no previous file with comments | « third_party/sqlite/src/test/filefmt.test ('k') | third_party/sqlite/src/test/fkey2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698