| Index: third_party/sqlite/src/test/e_fkey.test | 
| diff --git a/third_party/sqlite/src/test/e_fkey.test b/third_party/sqlite/src/test/e_fkey.test | 
| index ae789d50723e59183c29461e284949c87b7e8bdc..09756505c3a16157af08a049dd65ca3f0b850947 100644 | 
| --- a/third_party/sqlite/src/test/e_fkey.test | 
| +++ b/third_party/sqlite/src/test/e_fkey.test | 
| @@ -135,9 +135,9 @@ reset_db | 
| # | 
| # This also tests that foreign key constraints are disabled by default. | 
| # | 
| -# EVIDENCE-OF: R-59578-04990 Foreign key constraints are disabled by | 
| +# EVIDENCE-OF: R-44261-39702 Foreign key constraints are disabled by | 
| # default (for backwards compatibility), so must be enabled separately | 
| -# for each database connection separately. | 
| +# for each database connection. | 
| # | 
| drop_all_tables | 
| do_test e_fkey-4.1 { | 
| @@ -163,9 +163,10 @@ do_test e_fkey-4.2 { | 
| } {world} | 
|  | 
| #------------------------------------------------------------------------- | 
| -# EVIDENCE-OF: R-15278-54456 The application can can also use a PRAGMA | 
| +# EVIDENCE-OF: R-08013-37737 The application can also use a PRAGMA | 
| # foreign_keys statement to determine if foreign keys are currently | 
| # enabled. | 
| + | 
| # | 
| # This also tests the example code in section 2 of foreignkeys.in. | 
| # | 
| @@ -211,7 +212,7 @@ do_test e_fkey-6.1 { | 
| catchsql { | 
| DELETE FROM t1 | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-6.2 { | 
| execsql { PRAGMA foreign_keys } | 
| } {1} | 
| @@ -265,11 +266,11 @@ do_test e_fkey-7.1 { | 
| # | 
| do_test e_fkey-8.1 { | 
| catchsql { INSERT INTO track VALUES(1, 'track 1', 1) } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-8.2 { | 
| execsql { INSERT INTO artist VALUES(2, 'artist 1') } | 
| catchsql { INSERT INTO track VALUES(1, 'track 1', 1) } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-8.2 { | 
| execsql { INSERT INTO track VALUES(1, 'track 1', 2) } | 
| } {} | 
| @@ -283,7 +284,7 @@ do_test e_fkey-8.2 { | 
| # | 
| do_test e_fkey-9.1 { | 
| catchsql { DELETE FROM artist WHERE artistid = 2 } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-9.2 { | 
| execsql { | 
| DELETE FROM track WHERE trackartist = 2; | 
| @@ -311,14 +312,14 @@ do_test e_fkey-10.2 { | 
| do_test e_fkey-10.3 { | 
| # Setting the trackid to a non-NULL value fails, of course. | 
| catchsql { UPDATE track SET trackartist = 5 WHERE trackid = 1 } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-10.4 { | 
| execsql { | 
| INSERT INTO artist VALUES(5, 'artist 5'); | 
| UPDATE track SET trackartist = 5 WHERE trackid = 1; | 
| } | 
| catchsql { DELETE FROM artist WHERE artistid = 5} | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-10.5 { | 
| execsql { | 
| UPDATE track SET trackartist = NULL WHERE trackid = 1; | 
| @@ -344,8 +345,8 @@ proc test_r52486_21352 {tn sql} { | 
| set res [catchsql $sql] | 
| set results { | 
| {0 {}} | 
| -    {1 {PRIMARY KEY must be unique}} | 
| -    {1 {foreign key constraint failed}} | 
| +    {1 {UNIQUE constraint failed: artist.artistid}} | 
| +    {1 {FOREIGN KEY constraint failed}} | 
| } | 
| if {[lsearch $results $res]<0} { | 
| error $res | 
| @@ -409,7 +410,7 @@ do_test e_fkey-12.1 { | 
| } {} | 
| do_test e_fkey-12.2 { | 
| catchsql { INSERT INTO track VALUES(14, 'Mr. Bojangles', NULL) } | 
| -} {1 {track.trackartist may not be NULL}} | 
| +} {1 {NOT NULL constraint failed: track.trackartist}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # EVIDENCE-OF: R-16127-35442 | 
| @@ -438,7 +439,7 @@ do_test e_fkey-13.1 { | 
| } {} | 
| do_test e_fkey-13.2 { | 
| catchsql { INSERT INTO track VALUES(14, 'Mr. Bojangles', 3) } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-13.3 { | 
| execsql { INSERT INTO track VALUES(14, 'Mr. Bojangles', NULL) } | 
| } {} | 
| @@ -446,7 +447,7 @@ do_test e_fkey-13.4 { | 
| catchsql { | 
| UPDATE track SET trackartist = 3 WHERE trackname = 'Mr. Bojangles'; | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-13.5 { | 
| execsql { | 
| INSERT INTO artist VALUES(3, 'Sammy Davis Jr.'); | 
| @@ -464,7 +465,7 @@ do_test e_fkey-14.1 { | 
| catchsql { | 
| DELETE FROM artist WHERE artistname = 'Frank Sinatra'; | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-14.2 { | 
| execsql { | 
| DELETE FROM track WHERE trackname = 'My Way'; | 
| @@ -475,7 +476,7 @@ do_test e_fkey-14.3 { | 
| catchsql { | 
| UPDATE artist SET artistid=4 WHERE artistname = 'Dean Martin'; | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-14.4 { | 
| execsql { | 
| DELETE FROM track WHERE trackname IN('That''s Amore', 'Christmas Blues'); | 
| @@ -513,7 +514,7 @@ do_test e_fkey-15.1 { | 
| proc test_efkey_45 {tn isError sql} { | 
| do_test e_fkey-15.$tn.1 " | 
| catchsql {$sql} | 
| -  " [lindex {{0 {}} {1 {foreign key constraint failed}}} $isError] | 
| +  " [lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError] | 
|  | 
| do_test e_fkey-15.$tn.2 { | 
| execsql { | 
| @@ -557,10 +558,10 @@ do_test e_fkey-16.2 { | 
| } {} | 
| do_test e_fkey-16.3 { | 
| catchsql { UPDATE t2 SET b = 'two' WHERE rowid = 1 } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-16.4 { | 
| catchsql { DELETE FROM t1 WHERE rowid = 1 } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # Specifically, test that when comparing child and parent key values the | 
| @@ -592,7 +593,7 @@ do_test e_fkey-17.3 { | 
| } {integer integer text} | 
| do_test e_fkey-17.4 { | 
| catchsql { DELETE FROM t1 WHERE rowid = 2 } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
| ########################################################################### | 
| ### SECTION 3: Required and Suggested Database Indexes | 
| @@ -627,7 +628,8 @@ proc test_efkey_57 {tn isError sql} { | 
| execsql $sql | 
| do_test e_fkey-18.$tn { | 
| catchsql { INSERT INTO t2 VALUES(NULL) } | 
| -  } [lindex {{0 {}} {1 {foreign key mismatch}}} $isError] | 
| +  } [lindex {{0 {}} {/1 {foreign key mismatch - ".*" referencing ".*"}/}} \ | 
| +     $isError] | 
| } | 
| test_efkey_57 2 0 { CREATE TABLE t1(x PRIMARY KEY) } | 
| test_efkey_57 3 0 { CREATE TABLE t1(x UNIQUE) } | 
| @@ -698,16 +700,16 @@ do_test e_fkey-19.2 { | 
| } {} | 
| do_test e_fkey-19.2 { | 
| catchsql { INSERT INTO child4 VALUES('xxx', 5) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child4" referencing "parent"}} | 
| do_test e_fkey-19.3 { | 
| catchsql { INSERT INTO child5 VALUES('xxx', 6) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child5" referencing "parent"}} | 
| do_test e_fkey-19.4 { | 
| catchsql { INSERT INTO child6 VALUES(2, 3) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child6" referencing "parent"}} | 
| do_test e_fkey-19.5 { | 
| catchsql { INSERT INTO child7 VALUES(3) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child7" referencing "parent"}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # Test errors in the database schema that are detected while preparing | 
| @@ -765,12 +767,12 @@ do_test e_fkey-20.1 { | 
|  | 
| foreach {tn tbl ptbl err} { | 
| 2 c1 {} "no such table: main.nosuchtable" | 
| -  3 c2 p2 "foreign key mismatch" | 
| -  4 c3 p3 "foreign key mismatch" | 
| -  5 c4 p4 "foreign key mismatch" | 
| -  6 c5 p5 "foreign key mismatch" | 
| -  7 c6 p6 "foreign key mismatch" | 
| -  8 c7 p7 "foreign key mismatch" | 
| +  3 c2 p2 "foreign key mismatch - \"c2\" referencing \"p2\"" | 
| +  4 c3 p3 "foreign key mismatch - \"c3\" referencing \"p3\"" | 
| +  5 c4 p4 "foreign key mismatch - \"c4\" referencing \"p4\"" | 
| +  6 c5 p5 "foreign key mismatch - \"c5\" referencing \"p5\"" | 
| +  7 c6 p6 "foreign key mismatch - \"c6\" referencing \"p6\"" | 
| +  8 c7 p7 "foreign key mismatch - \"c7\" referencing \"p7\"" | 
| } { | 
| do_test e_fkey-20.$tn.1 { | 
| catchsql "INSERT INTO $tbl VALUES('a', 'b')" | 
| @@ -820,22 +822,22 @@ do_test e_fkey-21.2 { | 
| } {} | 
| do_test e_fkey-21.3 { | 
| catchsql { INSERT INTO child9 VALUES('I') } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child9" referencing "parent2"}} | 
| do_test e_fkey-21.4 { | 
| catchsql { INSERT INTO child9 VALUES('II') } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child9" referencing "parent2"}} | 
| do_test e_fkey-21.5 { | 
| catchsql { INSERT INTO child9 VALUES(NULL) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child9" referencing "parent2"}} | 
| do_test e_fkey-21.6 { | 
| catchsql { INSERT INTO child10 VALUES('I', 'II', 'III') } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child10" referencing "parent2"}} | 
| do_test e_fkey-21.7 { | 
| catchsql { INSERT INTO child10 VALUES(1, 2, 3) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child10" referencing "parent2"}} | 
| do_test e_fkey-21.8 { | 
| catchsql { INSERT INTO child10 VALUES(NULL, NULL, NULL) } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "child10" referencing "parent2"}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # Test errors that are reported when creating the child table. | 
| @@ -895,7 +897,7 @@ do_test e_fkey-23.1 { | 
| proc test_efkey_60 {tn isError sql} { | 
| do_test e_fkey-23.$tn " | 
| catchsql {$sql} | 
| -  " [lindex {{0 {}} {1 {foreign key constraint failed}}} $isError] | 
| +  " [lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError] | 
| } | 
|  | 
| test_efkey_60 2 1 "INSERT INTO c1 VALUES(239, 231)" | 
| @@ -932,7 +934,7 @@ do_test e_fkey-24.1 { | 
| proc test_efkey_61 {tn isError sql} { | 
| do_test e_fkey-24.$tn " | 
| catchsql {$sql} | 
| -  " [lindex {{0 {}} {1 {foreign key constraint failed}}} $isError] | 
| +  " [lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError] | 
| } | 
| foreach {tn c} [list 2 c1 3 c2 4 c3] { | 
| test_efkey_61 $tn.1 1 "INSERT INTO $c VALUES(1, 2)" | 
| @@ -973,15 +975,15 @@ do_execsql_test e_fkey-25.2 { | 
| EXPLAIN QUERY PLAN DELETE FROM artist WHERE 1; | 
| EXPLAIN QUERY PLAN SELECT rowid FROM track WHERE trackartist = ?; | 
| } { | 
| -  0 0 0 {SCAN TABLE artist (~1000000 rows)} | 
| -  0 0 0 {SCAN TABLE track (~100000 rows)} | 
| +  0 0 0 {SCAN TABLE artist} | 
| +  0 0 0 {SCAN TABLE track} | 
| } | 
| do_execsql_test e_fkey-25.3 { | 
| PRAGMA foreign_keys = ON; | 
| EXPLAIN QUERY PLAN DELETE FROM artist WHERE 1; | 
| } { | 
| -  0 0 0 {SCAN TABLE artist (~1000000 rows)} | 
| -  0 0 0 {SCAN TABLE track (~100000 rows)} | 
| +  0 0 0 {SCAN TABLE artist} | 
| +  0 0 0 {SCAN TABLE track} | 
| } | 
| do_test e_fkey-25.4 { | 
| execsql { | 
| @@ -997,7 +999,7 @@ do_test e_fkey-25.5 { | 
| concat \ | 
| [execsql { SELECT rowid FROM track WHERE trackartist = 5 }]   \ | 
| [catchsql { DELETE FROM artist WHERE artistid = 5 }] | 
| -} {1 1 {foreign key constraint failed}} | 
| +} {1 1 {FOREIGN KEY constraint failed}} | 
|  | 
| do_test e_fkey-25.6 { | 
| concat \ | 
| @@ -1009,7 +1011,7 @@ do_test e_fkey-25.7 { | 
| concat \ | 
| [execsql { SELECT rowid FROM track WHERE trackartist = 6 }]   \ | 
| [catchsql { DELETE FROM artist WHERE artistid = 6 }] | 
| -} {2 1 {foreign key constraint failed}} | 
| +} {2 1 {FOREIGN KEY constraint failed}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # EVIDENCE-OF: R-47936-10044 Or, more generally: | 
| @@ -1098,15 +1100,15 @@ do_test e_fkey-27.2 { | 
| do_execsql_test e_fkey-27.3 { | 
| EXPLAIN QUERY PLAN UPDATE artist SET artistid = ?, artistname = ? | 
| } { | 
| -  0 0 0 {SCAN TABLE artist (~1000000 rows)} | 
| -  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?) (~10 rows)} | 
| -  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?) (~10 rows)} | 
| +  0 0 0 {SCAN TABLE artist} | 
| +  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?)} | 
| +  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?)} | 
| } | 
| do_execsql_test e_fkey-27.4 { | 
| EXPLAIN QUERY PLAN DELETE FROM artist | 
| } { | 
| -  0 0 0 {SCAN TABLE artist (~1000000 rows)} | 
| -  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?) (~10 rows)} | 
| +  0 0 0 {SCAN TABLE artist} | 
| +  0 0 0 {SEARCH TABLE track USING COVERING INDEX trackindex (trackartist=?)} | 
| } | 
|  | 
|  | 
| @@ -1151,7 +1153,7 @@ do_test e_fkey-28.8 { | 
| CREATE TABLE c(a, b, FOREIGN KEY(a,b) REFERENCES p); | 
| } | 
| catchsql {DELETE FROM p} | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "c" referencing "p"}} | 
| do_test e_fkey-28.9 { | 
| drop_all_tables | 
| execsql { | 
| @@ -1159,7 +1161,7 @@ do_test e_fkey-28.9 { | 
| CREATE TABLE c(a REFERENCES p); | 
| } | 
| catchsql {DELETE FROM p} | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "c" referencing "p"}} | 
|  | 
|  | 
| #------------------------------------------------------------------------- | 
| @@ -1198,7 +1200,7 @@ do_test e_fkey-29.3 { | 
| catchsql { | 
| INSERT INTO song VALUES(2, 'Elvis Presley', 'Elvis Is Back!', 'Fever'); | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
|  | 
| #------------------------------------------------------------------------- | 
| @@ -1239,7 +1241,7 @@ do_test e_fkey-31.1 { | 
| do_test e_fkey-31.2 { | 
| # Execute a statement that violates the immediate FK constraint. | 
| catchsql { INSERT INTO prince VALUES(1, 2) } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
| do_test e_fkey-31.3 { | 
| # This time, use a trigger to fix the constraint violation before the | 
| @@ -1264,7 +1266,7 @@ do_test e_fkey-31.4 { | 
| DROP TRIGGER kt; | 
| } | 
| catchsql { INSERT INTO prince VALUES(3, 4) } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-31.5 { | 
| execsql { | 
| COMMIT; | 
| @@ -1295,7 +1297,7 @@ do_test e_fkey-31.5 { | 
| proc test_efkey_34 {tn isError sql} { | 
| do_test e_fkey-32.$tn " | 
| catchsql {$sql} | 
| -  " [lindex {{0 {}} {1 {foreign key constraint failed}}} $isError] | 
| +  " [lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError] | 
| } | 
| drop_all_tables | 
|  | 
| @@ -1326,7 +1328,7 @@ drop_all_tables | 
| proc test_efkey_35 {tn isError sql} { | 
| do_test e_fkey-33.$tn " | 
| catchsql {$sql} | 
| -  " [lindex {{0 {}} {1 {foreign key constraint failed}}} $isError] | 
| +  " [lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError] | 
| } | 
| do_test e_fkey-33.1 { | 
| execsql { | 
| @@ -1416,7 +1418,7 @@ do_test e_fkey-34.1 { | 
|  | 
| proc test_efkey_29 {tn sql isError} { | 
| do_test e_fkey-34.$tn "catchsql {$sql}" [ | 
| -    lindex {{0 {}} {1 {foreign key constraint failed}}} $isError | 
| +    lindex {{0 {}} {1 {FOREIGN KEY constraint failed}}} $isError | 
| ] | 
| } | 
| test_efkey_29  2 "BEGIN"                                   0 | 
| @@ -1490,7 +1492,7 @@ do_test e_fkey-35.2 { | 
| INSERT INTO track VALUES(1, 'White Christmas', 5); | 
| } | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-35.3 { | 
| execsql { | 
| INSERT INTO artist VALUES(5, 'Bing Crosby'); | 
| @@ -1527,7 +1529,7 @@ do_test e_fkey-36.2 { | 
| } {} | 
| do_test e_fkey-36.3 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-36.4 { | 
| execsql { | 
| UPDATE t1 SET a = 5 WHERE a = 4; | 
| @@ -1557,7 +1559,7 @@ do_test e_fkey-37.1 { | 
| } {} | 
| do_test e_fkey-37.2 { | 
| catchsql {RELEASE one} | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-37.3 { | 
| execsql { | 
| UPDATE t1 SET a = 7 WHERE a = 6; | 
| @@ -1574,7 +1576,7 @@ do_test e_fkey-37.4 { | 
| } {} | 
| do_test e_fkey-37.5 { | 
| catchsql {RELEASE one} | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-37.6 { | 
| execsql {ROLLBACK TO one ; RELEASE one} | 
| } {} | 
| @@ -1605,7 +1607,7 @@ do_test e_fkey-38.2 { | 
| } {1 1 2 2 3 3 4 4 5 6} | 
| do_test e_fkey-38.3 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-38.4 { | 
| execsql { | 
| ROLLBACK TO one; | 
| @@ -1626,11 +1628,11 @@ do_test e_fkey-38.5 { | 
| } {} | 
| do_test e_fkey-38.6 { | 
| catchsql {RELEASE a} | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-38.7 { | 
| execsql  {ROLLBACK TO c} | 
| catchsql {RELEASE a} | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-38.8 { | 
| execsql  { | 
| ROLLBACK TO b; | 
| @@ -1781,7 +1783,7 @@ do_test e_fkey-41.2 { | 
| } {j k l m} | 
| do_test e_fkey-41.3 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-41.4 { | 
| execsql ROLLBACK | 
| } {} | 
| @@ -1819,10 +1821,10 @@ do_test e_fkey-41.2 { | 
| } {} | 
| do_test e_fkey-41.3 { | 
| catchsql { DELETE FROM parent WHERE p1 = 'a' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-41.4 { | 
| catchsql { UPDATE parent SET p2 = 'e' WHERE p1 = 'c' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
| #------------------------------------------------------------------------- | 
| # Test that RESTRICT is slightly different from NO ACTION for IMMEDIATE | 
| @@ -1856,7 +1858,7 @@ do_test e_fkey-42.1 { | 
| } {} | 
| do_test e_fkey-42.2 { | 
| catchsql { UPDATE parent SET x = 'key one' WHERE x = 'key1' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-42.3 { | 
| execsql { | 
| UPDATE parent SET x = 'key two' WHERE x = 'key2'; | 
| @@ -1884,7 +1886,7 @@ do_test e_fkey-42.4 { | 
| } {} | 
| do_test e_fkey-42.5 { | 
| catchsql { DELETE FROM parent WHERE x = 'key1' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-42.6 { | 
| execsql { | 
| DELETE FROM parent WHERE x = 'key2'; | 
| @@ -1907,7 +1909,7 @@ do_test e_fkey-42.7 { | 
| } {} | 
| do_test e_fkey-42.8 { | 
| catchsql { REPLACE INTO parent VALUES('key1') } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-42.9 { | 
| execsql { | 
| REPLACE INTO parent VALUES('key2'); | 
| @@ -1943,13 +1945,13 @@ do_test e_fkey-43.1 { | 
| } {} | 
| do_test e_fkey-43.2 { | 
| catchsql { UPDATE parent SET x = 'key one' WHERE x = 'key1' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-43.3 { | 
| execsql { UPDATE parent SET x = 'key two' WHERE x = 'key2' } | 
| } {} | 
| do_test e_fkey-43.4 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-43.5 { | 
| execsql { | 
| UPDATE child2 SET c = 'key two'; | 
| @@ -1977,13 +1979,13 @@ do_test e_fkey-43.6 { | 
| } {} | 
| do_test e_fkey-43.7 { | 
| catchsql { DELETE FROM parent WHERE x = 'key1' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-43.8 { | 
| execsql { DELETE FROM parent WHERE x = 'key2' } | 
| } {} | 
| do_test e_fkey-43.9 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-43.10 { | 
| execsql { | 
| UPDATE child2 SET c = NULL; | 
| @@ -2060,7 +2062,7 @@ do_test e_fkey-45.1 { | 
| do_test e_fkey-45.2 { | 
| execsql { | 
| DELETE FROM pA WHERE rowid = 3; | 
| -    SELECT quote(x) FROM pA; | 
| +    SELECT quote(x) FROM pA ORDER BY rowid; | 
| } | 
| } {X'0000' X'9999' X'1234'} | 
| do_test e_fkey-45.3 { | 
| @@ -2069,7 +2071,7 @@ do_test e_fkey-45.3 { | 
| do_test e_fkey-45.4 { | 
| execsql { | 
| UPDATE pA SET x = X'8765' WHERE rowid = 4; | 
| -    SELECT quote(x) FROM pA; | 
| +    SELECT quote(x) FROM pA ORDER BY rowid; | 
| } | 
| } {X'0000' X'9999' X'8765'} | 
| do_test e_fkey-45.5 { | 
| @@ -2239,7 +2241,7 @@ do_test e_fkey-49.3 { | 
| } {ONE two three} | 
| do_test e_fkey-49.4 { | 
| catchsql { UPDATE parent SET a = '' WHERE a = 'oNe' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
|  | 
|  | 
| #------------------------------------------------------------------------- | 
| @@ -2274,7 +2276,7 @@ do_test e_fkey-50.1 { | 
| } {} | 
| do_test e_fkey-50.2 { | 
| catchsql { DELETE FROM artist WHERE artistname = 'Sammy Davis Jr.' } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-50.3 { | 
| execsql { | 
| INSERT INTO artist VALUES(0, 'Unknown Artist'); | 
| @@ -2325,7 +2327,7 @@ do_test e_fkey-51.1 { | 
| do_test e_fkey-51.2 { | 
| execsql { | 
| UPDATE parent SET x = 22; | 
| -    SELECT * FROM parent UNION ALL SELECT 'xxx' UNION ALL SELECT a FROM child; | 
| +    SELECT * FROM parent ORDER BY rowid; SELECT 'xxx' ; SELECT a FROM child; | 
| } | 
| } {22 21 23 xxx 22} | 
| do_test e_fkey-51.3 { | 
| @@ -2335,7 +2337,7 @@ do_test e_fkey-51.3 { | 
| INSERT INTO parent VALUES(-1); | 
| INSERT INTO child VALUES(-1); | 
| UPDATE parent SET x = 22; | 
| -    SELECT * FROM parent UNION ALL SELECT 'xxx' UNION ALL SELECT a FROM child; | 
| +    SELECT * FROM parent ORDER BY rowid; SELECT 'xxx' ; SELECT a FROM child; | 
| } | 
| } {22 23 21 xxx 23} | 
|  | 
| @@ -2638,7 +2640,7 @@ do_test e_fkey-58.1 { | 
| } | 
| execsql { INSERT INTO c5 VALUES('a', 'b') } | 
| catchsql { DROP TABLE p } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-58.2 { | 
| execsql { SELECT * FROM p } | 
| } {a b} | 
| @@ -2647,7 +2649,7 @@ do_test e_fkey-58.3 { | 
| BEGIN; | 
| DROP TABLE p; | 
| } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-58.4 { | 
| execsql { | 
| SELECT * FROM p; | 
| @@ -2681,11 +2683,11 @@ do_test e_fkey-59.2 { | 
| } {} | 
| do_test e_fkey-59.3 { | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-59.4 { | 
| execsql { CREATE TABLE p(a, b, PRIMARY KEY(a, b)) } | 
| catchsql COMMIT | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-59.5 { | 
| execsql { INSERT INTO p VALUES('a', 'b') } | 
| execsql COMMIT | 
| @@ -2729,19 +2731,19 @@ do_test e_fkey-60.3 { | 
| do_test e_fkey-60.4 { | 
| execsql { CREATE TABLE nosuchtable(x PRIMARY KEY) } | 
| catchsql { DELETE FROM p } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "c2" referencing "p"}} | 
| do_test e_fkey-60.5 { | 
| execsql { DROP TABLE c1 } | 
| catchsql { DELETE FROM p } | 
| -} {1 {foreign key mismatch}} | 
| +} {1 {foreign key mismatch - "c2" referencing "p"}} | 
| do_test e_fkey-60.6 { | 
| execsql { DROP TABLE c2 } | 
| execsql { DELETE FROM p } | 
| } {} | 
|  | 
| #------------------------------------------------------------------------- | 
| -# Test that the special behaviours of ALTER and DROP TABLE are only | 
| -# activated when foreign keys are enabled. Special behaviours are: | 
| +# Test that the special behaviors of ALTER and DROP TABLE are only | 
| +# activated when foreign keys are enabled. Special behaviors are: | 
| # | 
| #   1. ADD COLUMN not allowing a REFERENCES clause with a non-NULL | 
| #      default value. | 
| @@ -2836,7 +2838,7 @@ foreach zMatch [list SIMPLE PARTIAL FULL Simple parTIAL FuLL ] { | 
| do_test e_fkey-62.$zMatch.2 { | 
| execsql { INSERT INTO p VALUES(1, 2, 3)         } | 
|  | 
| -    # MATCH SIMPLE behaviour: Allow any child key that contains one or more | 
| +    # MATCH SIMPLE behavior: Allow any child key that contains one or more | 
| # NULL value to be inserted. Non-NULL values do not have to map to any | 
| # parent key values, so long as at least one field of the child key is | 
| # NULL. | 
| @@ -2848,7 +2850,7 @@ foreach zMatch [list SIMPLE PARTIAL FULL Simple parTIAL FuLL ] { | 
| # Check that the FK is enforced properly if there are no NULL values | 
| # in the child key columns. | 
| catchsql { INSERT INTO c VALUES('a', 2, 4) } | 
| -  } {1 {foreign key constraint failed}} | 
| +  } {1 {FOREIGN KEY constraint failed}} | 
| } | 
|  | 
| #------------------------------------------------------------------------- | 
| @@ -2878,13 +2880,13 @@ do_test e_fkey-62.3 { | 
| } {} | 
| do_test e_fkey-62.4 { | 
| catchsql { INSERT INTO ci VALUES('x', 'y') } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-62.5 { | 
| catchsql { INSERT INTO cd VALUES('x', 'y') } | 
| } {0 {}} | 
| do_test e_fkey-62.6 { | 
| catchsql { COMMIT } | 
| -} {1 {foreign key constraint failed}} | 
| +} {1 {FOREIGN KEY constraint failed}} | 
| do_test e_fkey-62.7 { | 
| execsql { | 
| DELETE FROM cd; | 
| @@ -2945,45 +2947,52 @@ proc test_on_update_recursion {limit} { | 
| " | 
| } | 
|  | 
| -do_test e_fkey-63.1.1 { | 
| -  test_on_delete_recursion $SQLITE_MAX_TRIGGER_DEPTH | 
| -} {0 0} | 
| -do_test e_fkey-63.1.2 { | 
| -  test_on_delete_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1] | 
| -} {1 {too many levels of trigger recursion}} | 
| -do_test e_fkey-63.1.3 { | 
| -  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5 | 
| -  test_on_delete_recursion 5 | 
| -} {0 0} | 
| -do_test e_fkey-63.1.4 { | 
| -  test_on_delete_recursion 6 | 
| -} {1 {too many levels of trigger recursion}} | 
| -do_test e_fkey-63.1.5 { | 
| -  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000 | 
| -} {5} | 
| -do_test e_fkey-63.2.1 { | 
| -  test_on_update_recursion $SQLITE_MAX_TRIGGER_DEPTH | 
| -} {0 0} | 
| -do_test e_fkey-63.2.2 { | 
| -  test_on_update_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1] | 
| -} {1 {too many levels of trigger recursion}} | 
| -do_test e_fkey-63.2.3 { | 
| -  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5 | 
| -  test_on_update_recursion 5 | 
| -} {0 0} | 
| -do_test e_fkey-63.2.4 { | 
| -  test_on_update_recursion 6 | 
| -} {1 {too many levels of trigger recursion}} | 
| -do_test e_fkey-63.2.5 { | 
| -  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000 | 
| -} {5} | 
| +# If the current build was created using clang with the -fsanitize=address | 
| +# switch, then the library uses considerably more stack space than usual. | 
| +# So much more, that some of the following tests cause stack overflows | 
| +# if they are run under this configuration. | 
| +# | 
| +if {[clang_sanitize_address]==0} { | 
| +  do_test e_fkey-63.1.1 { | 
| +    test_on_delete_recursion $SQLITE_MAX_TRIGGER_DEPTH | 
| +  } {0 0} | 
| +  do_test e_fkey-63.1.2 { | 
| +    test_on_delete_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1] | 
| +  } {1 {too many levels of trigger recursion}} | 
| +  do_test e_fkey-63.1.3 { | 
| +    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5 | 
| +      test_on_delete_recursion 5 | 
| +  } {0 0} | 
| +  do_test e_fkey-63.1.4 { | 
| +    test_on_delete_recursion 6 | 
| +  } {1 {too many levels of trigger recursion}} | 
| +  do_test e_fkey-63.1.5 { | 
| +    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000 | 
| +  } {5} | 
| +  do_test e_fkey-63.2.1 { | 
| +    test_on_update_recursion $SQLITE_MAX_TRIGGER_DEPTH | 
| +  } {0 0} | 
| +  do_test e_fkey-63.2.2 { | 
| +    test_on_update_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1] | 
| +  } {1 {too many levels of trigger recursion}} | 
| +  do_test e_fkey-63.2.3 { | 
| +    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5 | 
| +      test_on_update_recursion 5 | 
| +  } {0 0} | 
| +  do_test e_fkey-63.2.4 { | 
| +    test_on_update_recursion 6 | 
| +  } {1 {too many levels of trigger recursion}} | 
| +  do_test e_fkey-63.2.5 { | 
| +    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000 | 
| +  } {5} | 
| +} | 
|  | 
| #------------------------------------------------------------------------- | 
| # The setting of the recursive_triggers pragma does not affect foreign | 
| # key actions. | 
| # | 
| -# EVIDENCE-OF: R-51769-32730 The PRAGMA recursive_triggers setting does | 
| -# not not affect the operation of foreign key actions. | 
| +# EVIDENCE-OF: R-44355-00270 The PRAGMA recursive_triggers setting does | 
| +# not affect the operation of foreign key actions. | 
| # | 
| foreach recursive_triggers_setting [list 0 1 ON OFF] { | 
| drop_all_tables | 
|  |