1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Correctly generate pre-UPDATE content for virtual columns that are used

by foreign key constraints.  Ticket [b9befa4b83a660cc]

FossilOrigin-Name: 40d3282ec285d9f724f6548283f48b601510cf5284da17485723fd650a68f436
This commit is contained in:
drh
2019-10-31 20:54:20 +00:00
parent 29974f7b91
commit ff37c40787
4 changed files with 24 additions and 13 deletions

View File

@ -145,4 +145,18 @@ foreach {tn schema} {
} {30 null ntalo | 40 text balaya | 150 integer {} | 1010 real {} |}
}
# 2019-10-31 ticket b9befa4b83a660cc
db close
sqlite3 db :memory:
do_execsql_test gencol1-3.100 {
PRAGMA foreign_keys = true;
CREATE TABLE t0(c0 PRIMARY KEY, c1, c2 AS (c0+c1-c3) REFERENCES t0, c3);
INSERT INTO t0 VALUES (0, 0, 0), (11, 5, 5);
UPDATE t0 SET c1 = c0, c3 = c0;
SELECT *, '|' FROM t0 ORDER BY +c0;
} {0 0 0 0 | 11 11 11 11 |}
do_catchsql_test gencol1-3.110 {
UPDATE t0 SET c1 = c0, c3 = c0+1;
} {1 {FOREIGN KEY constraint failed}}
finish_test