Fix LIKE escape mapping with value converters - #3889
Merged
Conversation
Keep LIKE and ILIKE escape expressions independent from match and pattern type mapping so property converters cannot rewrite provider-generated escape values. 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 00:22
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.
Fixes an issue where value converters on LIKE/ILIKE match properties were inadvertently applied to the provider-generated escape expression, resulting in ESCAPE NULL and unknown predicate evaluation.
Changes:
- Applies type mapping to
LikeExpressionvia provider logic to keep escape-character mapping independent of match/pattern inference. - Updates
PgILikeExpressiontype mapping to avoid inheriting value converters for the escape expression. - Adds a regression test covering value-converted properties with parameterized patterns and implicit escape.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs | Adds a regression test validating LIKE/ILIKE SQL uses ESCAPE '' even with a value converter on the match property. |
| src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs | Adjusts LIKE/ILIKE type mapping so the escape expression does not inherit converters from match/pattern. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Low
This was referenced Jul 23, 2026
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.
A value converter on a LIKE/ILIKE match property could also be applied to the escape expression, converting the provider-generated empty escape into
ESCAPE NULLand causing matching predicates to evaluate as unknown.This change keeps escape-character type mapping independent from match/pattern inference for both LIKE and ILIKE. It also adds regression coverage that verifies converted properties still match and generate
ESCAPE ''for parameterized patterns.Tests:
AdHocMiscellaneousQueryNpgsqlTest.Like_with_implicit_escape_does_not_apply_value_converterNorthwindDbFunctionsQueryNpgsqlTest(41 tests)Fixes: #3888