1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

IB: FK cascade delete when parent versioned [fixes #101]

This commit is contained in:
Aleksey Midenkov
2016-12-21 05:57:00 +00:00
parent 412dd1e1f3
commit 46badf17c4
3 changed files with 63 additions and 15 deletions

View File

@@ -52,21 +52,41 @@ insert into child values(1);
delete from parent where id = 1;
select * from child;
parent_id
select * from child for system_time from timestamp '1-1-1' to timestamp now(6);
select * from child for system_time all;
parent_id
1
insert into parent values(1);
insert into child values(1);
update parent set id=id+1;
update parent set id = id + 1;
select * from child;
parent_id
2
select * from child for system_time from timestamp '1-1-1' to timestamp now(6);
select * from child for system_time all;
parent_id
1
2
drop table child;
drop table parent;
create or replace table parent (
id int primary key
) with system versioning
engine innodb;
create or replace table child (
x int,
parent_id int not null,
constraint `parent-fk`
foreign key (parent_id) references parent (id)
on delete cascade
on update restrict
)
engine innodb;
insert into parent (id) values (1);
insert into child (x, parent_id) values (1, 1);
delete from parent;
select * from child;
x parent_id
drop table child;
drop table parent;
create table parent(
id int unique key
) engine innodb;