Handle absent LIKE escape expressions explicitly - #3890
Merged
Conversation
Preserve null escape expressions before applying default type mapping for LIKE and ILIKE. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e5b861c2-ea5b-411c-8efe-3d925d29c52e
roji
enabled auto-merge (squash)
July 23, 2026 17:05
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Updates type-mapping application for LIKE/ILIKE escape expressions to explicitly preserve null rather than relying on ApplyDefaultTypeMapping handling null, clarifying optional ESCAPE semantics.
Changes:
- Preserve
nullforLikeExpression.EscapeCharbefore applying default type mapping - Preserve
nullforPgILikeExpression.EscapeCharbefore applying default type mapping
Show a summary per file
| File | Description |
|---|---|
| src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs | Makes LIKE/ILIKE escape type-mapping explicitly null-preserving to reflect optional ESCAPE behavior |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Low
| ApplyTypeMapping(likeExpression.Pattern, inferredTypeMapping), | ||
| // The escape character must not inherit the match or pattern's value converter (#3888). | ||
| ApplyDefaultTypeMapping(likeExpression.EscapeChar), | ||
| likeExpression.EscapeChar is null ? null : ApplyDefaultTypeMapping(likeExpression.EscapeChar), |
| ApplyTypeMapping(ilikeExpression.Pattern, inferredTypeMapping), | ||
| // The escape character must not inherit the match or pattern's value converter (#3888). | ||
| ApplyDefaultTypeMapping(ilikeExpression.EscapeChar), | ||
| ilikeExpression.EscapeChar is null ? null : ApplyDefaultTypeMapping(ilikeExpression.EscapeChar), |
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.
Follow-up to #3889: LIKE and ILIKE escape expressions are optional, so preserve
nullexplicitly before applying the independent default string type mapping.This makes the optional escape behavior clear and avoids relying on
ApplyDefaultTypeMappingaccepting a null expression.Tests:
NorthwindDbFunctionsQueryNpgsqlTest(41 tests)Fixes: #3888