mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-19 15:05:47 +01:00
dont validate fkey on parent add tests
correct msitake and add null test issue add fkey test
This commit is contained in:
@@ -968,8 +968,6 @@ impl Schema {
|
||||
None
|
||||
} else {
|
||||
find_parent_unique(&parent_cols)
|
||||
.ok_or_else(|| fk_mismatch_err(&child.name, &parent_tbl.name))?
|
||||
.into()
|
||||
};
|
||||
fk.validate()?;
|
||||
out.push(ResolvedFkRef {
|
||||
|
||||
@@ -1207,3 +1207,34 @@ do_execsql_test_in_memory_any_error fk-update-parent-multi-col-pk-2 {
|
||||
INSERT INTO child VALUES(1, 2);
|
||||
UPDATE parent SET b = 3 WHERE a = 1 AND b = 2;
|
||||
}
|
||||
|
||||
# https://github.com/tursodatabase/turso/issues/3965
|
||||
do_execsql_test_on_specific_db {:memory:} fk-no-val-on-parent {
|
||||
PRAGMA foreign_keys=ON;
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT
|
||||
);
|
||||
CREATE TABLE t2(
|
||||
x INT,
|
||||
y INT,
|
||||
FOREIGN KEY (x, y) REFERENCES t1(a, b)
|
||||
);
|
||||
INSERT INTO t1(a, b) VALUES (5, 10);
|
||||
SELECT * FROM t1;
|
||||
} {5|10}
|
||||
|
||||
do_execsql_test_in_memory_any_error fk-val-on-parent {
|
||||
PRAGMA foreign_keys=ON;
|
||||
CREATE TABLE t1(
|
||||
a INT,
|
||||
b INT
|
||||
);
|
||||
CREATE TABLE t2(
|
||||
x INT,
|
||||
y INT,
|
||||
FOREIGN KEY (x, y) REFERENCES t1(a, b)
|
||||
);
|
||||
INSERT INTO t2(a, b) VALUES (5, 10);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ do_execsql_test sel-false {
|
||||
select false;
|
||||
} {0}
|
||||
|
||||
# https://github.com/tursodatabase/turso/issues/3966
|
||||
do_execsql_test_on_specific_db {:memory:} not-null-just-cuz-unique {
|
||||
create table t (a int, x int unique);
|
||||
insert into t(a) values(1);
|
||||
|
||||
Reference in New Issue
Block a user