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

Foreign key corruption: foreign key has entered an invalid state #8954

Open
zachmu opened this issue Mar 6, 2025 · 0 comments
Open

Foreign key corruption: foreign key has entered an invalid state #8954

zachmu opened this issue Mar 6, 2025 · 0 comments
Labels
bug Something isn't working no repro Bugs that can't be reproduced easily sql Issue with SQL

Comments

@zachmu
Copy link
Member

zachmu commented Mar 6, 2025

It's possible for foreign keys in Dolt to become corrupted through certain schema changes, exact mechanism unclear at this point. The symptom is that a call to dolt_commit() fails with a message like this:

Failed to commit changes.
cause: foreign key `paperinfo02_ibfk_1` has entered an invalid state, table `paperinfo02` is missing the index `pinc2`

The workaround is to drop and recreate the foreign key with the same definition.

alter table paperinfo02 drop constraint `paperinfo02_ibfk_1`;
alter table paperinfo02 add constraint `paperinfo02_ibfk_1` FOREIGN KEY (`id_coderinfo`) REFERENCES `coderinfo02` (`id_coderinfo`);

If you encounter this bug and can reproduce it, please comment to let us know.

@timsehn timsehn added bug Something isn't working sql Issue with SQL no repro Bugs that can't be reproduced easily labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no repro Bugs that can't be reproduced easily sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

2 participants