Add tests for UPDATE...FROM and foreign keys.
FossilOrigin-Name: 6c3668f9ed898337e664bec95865f15688a6bba43f095358dda5d08abef2bbaa
This commit is contained in:
parent
576d5a8634
commit
e7cf8fdd17
12
manifest
12
manifest
@ -1,6 +1,6 @@
|
||||
B 5ee3c27e20d12a126fb773b428bb864102b949a5b26a8d5c523753dcedf4be10
|
||||
C Fix\sproblems\sthat\scould\soccur\sif\sa\stable\swith\sthe\ssame\sname\sas\sthe\stable\sbeing\supdated\sappeared\sin\sthe\sFROM\sclause\sof\san\sUPDATE\sstatement.
|
||||
D 2020-07-15T18:30:01.625
|
||||
C Add\stests\sfor\sUPDATE...FROM\sand\sforeign\skeys.
|
||||
D 2020-07-15T19:38:49.186
|
||||
F src/alter.c c63fb72ae0ca39175996fcf7008d44022a7ea99e03c0af3e1d968505ceff7120
|
||||
F src/attach.c 0b11e00c166b622c84ec176773b1d691c61ad07d247809e3e1635d4e99e71d30
|
||||
F src/btree.c b8b0e80c8bbe4e1fb35ae559e9e9aa009799c20cf12f159ebb503b05be1fab9b
|
||||
@ -18,8 +18,8 @@ F test/fuzzdata8.db 281cbc8166a8bc5843f4a913e803ba76e27905eb02fb9d5cfd581c2429f2
|
||||
F test/triggerupfrom.test d25961fa70a99b6736193da7b49a36d8c1d28d56188f0be6406d4366315cd6e4
|
||||
F test/upfrom1.tcl df984cb88010af1555812af55e9db44c4df50677395b45d1f30b69b1b6c07b73
|
||||
F test/upfrom1.test 2ba1ed45b4a2161fc79f234b9ce4300b0d3deba545e3f23b938fb3ebdbf8758d
|
||||
F test/upfrom3.test 3890e1fc372aaf70ca88ec2650f4574b169368a5a63770245a45a28f1524b1b9
|
||||
P 5176cb7a6a4e8cfa1973aaae46fcd7d39baedb70ae20bfacc82d62ca39fb0aa3
|
||||
R 5994321bbabb2542296f6db00df19961
|
||||
F test/upfrom3.test f47fe3249927af1f912610840597948817f89d8d9d903f4b0a0857b062492758
|
||||
P 13224cbd75990615088f3e30ccba05d31b3099fae4300c9ab8f7663bc5f0eb6f
|
||||
R 951f7375cdb1b317e0c85e964bd78974
|
||||
U dan
|
||||
Z 41a21fcf4a769b492a5346939daeca22
|
||||
Z 51ee7aa4a4964c7d09979adeefa9f96b
|
||||
|
@ -1 +1 @@
|
||||
13224cbd75990615088f3e30ccba05d31b3099fae4300c9ab8f7663bc5f0eb6f
|
||||
6c3668f9ed898337e664bec95865f15688a6bba43f095358dda5d08abef2bbaa
|
@ -25,6 +25,8 @@ set testprefix upfrom3
|
||||
# 3.*: Test that UPDATE ... FROM statements are not confused if there
|
||||
# are multiple tables of the same name in attached databases.
|
||||
#
|
||||
# 4.*: Tests for UPDATE ... FROM statements and foreign keys.
|
||||
#
|
||||
|
||||
foreach {tn wo} {
|
||||
1 ""
|
||||
@ -209,5 +211,52 @@ foreach {tn wo} {
|
||||
}]
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
foreach {tn wo} {
|
||||
1 ""
|
||||
2 "WITHOUT ROWID"
|
||||
} {
|
||||
reset_db
|
||||
forcedelete test.db2
|
||||
eval [string map [list %WO% $wo %TN% $tn] {
|
||||
|
||||
do_execsql_test 4.$tn.1 {
|
||||
CREATE TABLE p1(a INTEGER PRIMARY KEY, b) %WO%;
|
||||
CREATE TABLE c1(x PRIMARY KEY, y REFERENCES p1 ON UPDATE CASCADE) %WO%;
|
||||
PRAGMA foreign_keys = 1;
|
||||
|
||||
INSERT INTO p1 VALUES(1, 'one');
|
||||
INSERT INTO p1 VALUES(11, 'eleven');
|
||||
INSERT INTO p1 VALUES(111, 'eleventyone');
|
||||
|
||||
INSERT INTO c1 VALUES('a', 1);
|
||||
INSERT INTO c1 VALUES('b', 11);
|
||||
INSERT INTO c1 VALUES('c', 111);
|
||||
}
|
||||
|
||||
do_execsql_test 4.$tn.2 {
|
||||
CREATE TABLE map(f, t);
|
||||
INSERT INTO map VALUES('a', 111);
|
||||
INSERT INTO map VALUES('c', 112);
|
||||
}
|
||||
|
||||
do_catchsql_test 4.$tn.3 {
|
||||
UPDATE c1 SET y=t FROM map WHERE x=f;
|
||||
} {1 {FOREIGN KEY constraint failed}}
|
||||
|
||||
do_execsql_test 4.$tn.4 {
|
||||
INSERT INTO map VALUES('eleven', 12);
|
||||
INSERT INTO map VALUES('eleventyone', 112);
|
||||
UPDATE p1 SET a=t FROM map WHERE b=f;
|
||||
}
|
||||
|
||||
do_execsql_test 4.$tn.5 {
|
||||
SELECT * FROM c1
|
||||
} {a 1 b 12 c 112}
|
||||
|
||||
}]
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user