Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue of foreign key cascade don't work #39419

Closed
crazycs520 opened this issue Nov 28, 2022 · 0 comments · Fixed by #39420
Closed

issue of foreign key cascade don't work #39419

crazycs520 opened this issue Nov 28, 2022 · 0 comments · Fixed by #39420

Comments

@crazycs520
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set @@global.tidb_enable_foreign_key=1;
set @@foreign_key_checks=1;
create table t1 (id int key);
create table t2 (id int key, a int, b int, foreign key fk_1 (a) references t1(id) ON DELETE SET NULL ON UPDATE SET NULL, foreign key fk_2 (b) references t1(id) ON DELETE CASCADE ON UPDATE CASCADE);
insert into t1 values (1), (2), (3);
insert into t2 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
update t1 set id=id+10 where id in (1, 3);
delete from t1 where id = 2;

2. What did you expect to see? (Required)

> select * from t2;
+----+--------+----+
| id | a      | b  |
+----+--------+----+
| 1  | <null> | 11 |
| 3  | <null> | 13 |
+----+--------+----+

3. What did you see instead (Required)

> select * from t2;
+----+--------+---+
| id | a      | b |
+----+--------+---+
| 1  | <null> | 1 |
| 2  | <null> | 2 |
| 3  | <null> | 3 |
+----+--------+---+
3 rows in set

4. What is your TiDB version? (Required)

master: 0e6364f

@crazycs520 crazycs520 added type/bug The issue is confirmed as a bug. type/new-feature sig/execution SIG execution and removed type/bug The issue is confirmed as a bug. labels Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant