-
Notifications
You must be signed in to change notification settings - Fork 249
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(psl): composite type validation in indices #4401
Conversation
psl/psl-core/src/validate/validation_pipeline/validations/indexes.rs
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #4401 will not alter performanceComparing Summary
|
afeaee9
to
e3f1ca5
Compare
@@ -123,7 +123,7 @@ pub(super) fn validate(ctx: &mut Context<'_>) { | |||
indexes::supports_clustering_setting(index, ctx); | |||
indexes::clustering_can_be_defined_only_once(index, ctx); | |||
indexes::opclasses_are_not_allowed_with_other_than_normal_indices(index, ctx); | |||
indexes::composite_types_are_not_allowed_in_index(index, ctx); | |||
indexes::composite_type_in_compound_unique_index(index, ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about normal indexes? Are those supported with a mix of scalar and composite fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't actually hit this error (fulltext also doesn't). Not to say they're supported but they run into different issues that are unrelated to the original crash report. Only @@unique
causes a panic from what I've found
There was a problem hiding this 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 anything particularly wrong, I only had a question about non-composite indexes, but Jan made it before and you replied already. So the changes look good to me, given the test cases you implemented.
@@ -91,7 +91,7 @@ impl ScalarField { | |||
|
|||
match scalar_field_type { | |||
ScalarFieldType::CompositeType(_) => { | |||
unreachable!("Cannot convert a composite type to a type identifier. This error is typically caused by mistakenly using a composite type within a composite index.",) | |||
unreachable!("This shouldn't be reached; composite types are not supported in compound unique indices.",) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less cryptic message 👍🏾
group String | ||
} | ||
#[test] | ||
fn converting_composite_types_compound_unique() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 to the exhaustive tests
- only check for composites in compound indexes - clarify message with respect to the above change tests - added test for nested scalar case
Add test to validate `@@index` case
7d1b385
to
a58ad02
Compare
Updated the composite type validation introduced here to only throw a validation error when encountering composite types in compound indices.
(Specifically unique indices as I can't reproduce this using either normal or fulltext indices)
fixes prisma/prisma#21441
contributes prisma/prisma#21723
related discovery page: notion