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

Check for foreign key constraint errors prior to returning the results from

a RETURNING clause.  See [forum:/forumpost/793beaf322|forum post 793beaf322].

FossilOrigin-Name: a818ba2ed635b91e279dde44236fc7446a33db2b46c9409b67021248c01bf4e5
This commit is contained in:
drh
2021-12-01 19:17:14 +00:00
parent 4baf43ff64
commit 3b26b2b56b
9 changed files with 52 additions and 35 deletions

View File

@ -333,4 +333,17 @@ do_execsql_test 13.1 {
} {{}}
} ;# end ifcapable rtree
# 2021-12-01 Forum post https://sqlite.org/forum/forumpost/793beaf322
# Need to report foreign key constraint errors prior to RETURNING
#
reset_db
do_execsql_test 14.0 {
PRAGMA foreign_keys(1);
CREATE TABLE Parent(id INTEGER PRIMARY KEY);
CREATE TABLE Child(id INTEGER PRIMARY KEY, parent_id INTEGER REFERENCES Parent(id));
} {}
do_catchsql_test 14.1 {
INSERT INTO child(parent_id) VALUES(123) RETURNING id;
} {1 {FOREIGN KEY constraint failed}}
finish_test