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

add foreign key need multi-schema change #38678

Closed
crazycs520 opened this issue Oct 27, 2022 · 0 comments · Fixed by #38679
Closed

add foreign key need multi-schema change #38678

crazycs520 opened this issue Oct 27, 2022 · 0 comments · Fixed by #38679
Labels
type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@crazycs520
Copy link
Contributor

crazycs520 commented Oct 27, 2022

Dev Task

At the same point in time, there may be two versions of the schema in the TiDB cluster, so we can't create foreign key in one schema version, since this may break foreign key constraint, such as delete reference table
without foreign key constrain check in child table.

-- In TiDB-1 and Schema Version is 1
insert into t_has_foreign_key values (1, 1);
-- In TiDB-0 and  Schema Version is 0
delete from t_reference where id = 1; --Since doesn't know foreign key information in old version, so doesn't do foreign key constrain check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant