Skip to content

Handle absent LIKE escape expressions explicitly - #3890

Merged
roji merged 1 commit into
mainfrom
roji-fix-null-like-escape
Jul 23, 2026
Merged

Handle absent LIKE escape expressions explicitly#3890
roji merged 1 commit into
mainfrom
roji-fix-null-like-escape

Conversation

@roji

@roji roji commented Jul 23, 2026

Copy link
Copy Markdown
Member

Follow-up to #3889: LIKE and ILIKE escape expressions are optional, so preserve null explicitly before applying the independent default string type mapping.

This makes the optional escape behavior clear and avoids relying on ApplyDefaultTypeMapping accepting a null expression.

Tests:

  • NorthwindDbFunctionsQueryNpgsqlTest (41 tests)

Fixes: #3888

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
Copilot AI review requested due to automatic review settings July 23, 2026 17:02
@roji
roji enabled auto-merge (squash) July 23, 2026 17:05
@roji
roji merged commit c715cff into main Jul 23, 2026
16 checks passed
@roji
roji deleted the roji-fix-null-like-escape branch July 23, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 null for LikeExpression.EscapeChar before applying default type mapping
  • Preserve null for PgILikeExpression.EscapeChar before 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),
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.

ILike implicit empty escape applies property ValueConverter, producing ESCAPE NULL

2 participants