Index: third_party/sqlite/src/test/fkey5.test |
diff --git a/third_party/sqlite/src/test/fkey5.test b/third_party/sqlite/src/test/fkey5.test |
index 5aa8b1d4b7aa7ecfa1023be9e317ea0ab63e250c..b9e1fc2eeccd024f37efb3df4921f1d7bd209182 100644 |
--- a/third_party/sqlite/src/test/fkey5.test |
+++ b/third_party/sqlite/src/test/fkey5.test |
@@ -12,8 +12,13 @@ |
# |
# This file tests the PRAGMA foreign_key_check command. |
# |
-# EVIDENCE-OF: R-05426-18119 PRAGMA foreign_key_check; PRAGMA |
-# foreign_key_check(table-name); |
+# EVIDENCE-OF: R-15402-03103 PRAGMA schema.foreign_key_check; PRAGMA |
+# schema.foreign_key_check(table-name); |
+# |
+# EVIDENCE-OF: R-23918-17301 The foreign_key_check pragma checks the |
+# database, or the table called "table-name", for foreign key |
+# constraints that are violated and returns one row of output for each |
+# violation. |
set testdir [file dirname $argv0] |
source $testdir/tester.tcl |
@@ -74,6 +79,16 @@ do_test fkey5-1.2 { |
PRAGMA foreign_key_check; |
} |
} {c1 87 p1 0 c1 90 p1 0} |
+do_test fkey5-1.2b { |
+ db eval { |
+ PRAGMA main.foreign_key_check; |
+ } |
+} {c1 87 p1 0 c1 90 p1 0} |
+do_test fkey5-1.2c { |
+ db eval { |
+ PRAGMA temp.foreign_key_check; |
+ } |
+} {} |
do_test fkey5-1.3 { |
db eval { |
PRAGMA foreign_key_check(c1); |
@@ -84,6 +99,16 @@ do_test fkey5-1.4 { |
PRAGMA foreign_key_check(c2); |
} |
} {} |
+do_test fkey5-1.5 { |
+ db eval { |
+ PRAGMA main.foreign_key_check(c2); |
+ } |
+} {} |
+do_test fkey5-1.6 { |
+ catchsql { |
+ PRAGMA temp.foreign_key_check(c2); |
+ } |
+} {1 {no such table: temp.c2}} |
# EVIDENCE-OF: R-45728-08709 There are four columns in each result row. |
# |
@@ -252,13 +277,17 @@ do_test fkey5-6.5 { |
} {c12 1 p4 0 c12 3 p4 0 c12 6 p4 0} |
do_test fkey5-7.1 { |
+ set res {} |
db eval { |
INSERT OR IGNORE INTO c13 SELECT * FROM c12; |
INSERT OR IGNORE INTO C14 SELECT * FROM c12; |
DELETE FROM c12; |
PRAGMA foreign_key_check; |
+ } { |
+ lappend res [list $table $rowid $fkid $parent] |
} |
-} {c14 1 p4 0 c14 3 p4 0 c14 6 p4 0 c13 1 p3 0 c13 2 p3 0 c13 3 p3 0 c13 4 p3 0 c13 5 p3 0 c13 6 p3 0} |
+ lsort $res |
+} {{c13 1 0 p3} {c13 2 0 p3} {c13 3 0 p3} {c13 4 0 p3} {c13 5 0 p3} {c13 6 0 p3} {c14 1 0 p4} {c14 3 0 p4} {c14 6 0 p4}} |
do_test fkey5-7.2 { |
db eval { |
PRAGMA foreign_key_check(c14); |