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

fix: two relations with same name should not panic #2994

Merged
merged 1 commit into from
Jun 21, 2022

Conversation

Weakky
Copy link
Member

@Weakky Weakky commented Jun 20, 2022

Overview

fixes prisma/prisma#12986

Two relations with a same name in a model was causing a panic.

@Weakky Weakky added this to the 4.0.x milestone Jun 20, 2022
Comment on lines +385 to +388
// Skip duplicate placeholders
if !result.contains(&placeholder) {
result.push(placeholder);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a HashSet or a HashMap was creating a waterfall of Eq and Hash requirements for lots of structs.
I decided to use Vec::contains so that we could reuse the existing PartialEq implementations. Let me know if that sucks too much.

Copy link
Contributor

@cprieto cprieto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see an immediate problem with result contains and all our current tests are passing, so I think is ok?

@Weakky Weakky merged commit 13cc0c0 into main Jun 21, 2022
@Weakky Weakky deleted the fix/panic-cluster/duplicate-relation-name branch June 21, 2022 09:37
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.

Misleading Error for non-unique relation names
2 participants