From 6cf2febdb47f69dc2400e69eb949e8bea1820c47 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 23 Jul 2026 10:02:22 -0700 Subject: [PATCH] Handle absent LIKE escape expressions explicitly 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 --- src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs b/src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs index 7fa8de2f0..7f668aa07 100644 --- a/src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs +++ b/src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs @@ -721,7 +721,7 @@ private SqlExpression ApplyTypeMappingOnLike(LikeExpression likeExpression) ApplyTypeMapping(likeExpression.Match, inferredTypeMapping), 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), _boolTypeMapping); } @@ -734,7 +734,7 @@ private SqlExpression ApplyTypeMappingOnILike(PgILikeExpression ilikeExpression) ApplyTypeMapping(ilikeExpression.Match, inferredTypeMapping), 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), _boolTypeMapping); }