Conversation
Member
|
@crjc tests are failing, so please do fix the failing tests, so we could merge the fix. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes core query translation null semantics broadly (not just for Guid?) without a regression test covering #360, which may impact existing queries unexpectedly.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR restores the pre-Pomelo 9.x translation behavior for ToString() on non-string expressions by removing the COALESCE(..., '') wrapper, aligning generated SQL more closely with the Pomelo 8.0 output referenced in issue #360.
Changes:
- Remove
COALESCEaroundConvert(..., typeof(string))inMySqlObjectToStringTranslatorso nullable values translate to nullable string expressions. - Restore the older null-handling behavior for comparisons involving
.ToString()in SQL translation (notably impactingGuid?).
| File | Description |
|---|---|
| src/EFCore.MySql/Query/Internal/MySqlObjectToStringTranslator.cs | Removes COALESCE from the ToString() translation for supported CLR types to match Pomelo 8.0-style SQL output. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
92
to
95
| // Enums are handled by EnumMethodTranslator. | ||
| return _supportedTypes.Contains(instance.Type) | ||
| ? _sqlExpressionFactory.Coalesce( | ||
| _sqlExpressionFactory.Convert(instance, typeof(string)), | ||
| _sqlExpressionFactory.Constant(string.Empty)) | ||
| ? _sqlExpressionFactory.Convert(instance, typeof(string)) | ||
| : null; |
Comment on lines
93
to
95
| return _supportedTypes.Contains(instance.Type) | ||
| ? _sqlExpressionFactory.Coalesce( | ||
| _sqlExpressionFactory.Convert(instance, typeof(string)), | ||
| _sqlExpressionFactory.Constant(string.Empty)) | ||
| ? _sqlExpressionFactory.Convert(instance, typeof(string)) | ||
| : null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Restores previous tostring query translation from older Pomelo versions. See #360