mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
77afc2be46
- Now DELETE IGNORE skips over rows with a foreign key constraints (as it was supposed to do) mysql-test/r/foreign_key.result: Test case for Bug#44987 DELETE IGNORE and FK constraint mysql-test/t/foreign_key.test: Test case for Bug#44987 DELETE IGNORE and FK constraint sql/sql_delete.cc: Firx for Bug#44987 DELETE IGNORE and FK constraint Now DELETE IGNORE skips over rows with a foreign key constraints (as it was supposed to do) Bug fix inspired by: Moritz Mertinkat
47 lines
1.1 KiB
Text
47 lines
1.1 KiB
Text
#
|
|
# Test syntax of foreign keys
|
|
#
|
|
|
|
-- source include/have_innodb.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists t1,t2;
|
|
--enable_warnings
|
|
|
|
create table t1 (
|
|
a int not null references t2,
|
|
b int not null references t2 (c),
|
|
primary key (a,b),
|
|
foreign key (a) references t3 match full,
|
|
foreign key (a) references t3 match partial,
|
|
foreign key (a,b) references t3 (c,d) on delete no action
|
|
on update no action,
|
|
foreign key (a,b) references t3 (c,d) on update cascade,
|
|
foreign key (a,b) references t3 (c,d) on delete set default,
|
|
foreign key (a,b) references t3 (c,d) on update set null);
|
|
|
|
create index a on t1 (a);
|
|
create unique index b on t1 (a,b);
|
|
drop table t1;
|
|
|
|
# End of 4.1 tests
|
|
|
|
#
|
|
# Test DELETE IGNORE
|
|
# Bug#44987 DELETE IGNORE and FK constraint
|
|
#
|
|
|
|
create table t1 (id int primary key) engine = innodb;
|
|
create table t2 (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES t1(id)) engine=innodb;
|
|
insert into t1 values (1), (2), (3), (4), (5), (6);
|
|
insert into t2 values (3), (5);
|
|
|
|
--error 1451
|
|
delete from t1;
|
|
select * from t1;
|
|
|
|
delete ignore from t1;
|
|
select row_count();
|
|
select * from t1;
|
|
drop table t2;
|
|
drop table t1;
|