Skip to content

Conversation

@feiniaofeiafei
Copy link
Contributor

picked from #58958

…8958)

Problem Summary:
Create two tables, t1 and t2. Create a primary key on table t1 and a
foreign key on table t2 referencing t1 primary key. Then drop table t2,
and then try to delete the primary key on t1.
doris will report error:

errCode = 2, detailMessage = Can not find table XXXX in constraint.

This is because the `foreignTables` metadata in the
`PrimaryKeyConstraint` was not updated when the foreign key table was
dropped. `foreignTables` stores the table IDs of the foreign key tables
that reference the primary key. When dropping the foreign key table or
drop the foreign key, the corresponding entries in `foreignTables`
should also be removed.
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@feiniaofeiafei
Copy link
Contributor Author

run buildall

@morrySnow morrySnow merged commit e975028 into apache:branch-3.1 Dec 22, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants