Skip to content

Commit

Permalink
Remove unneeded backslash ESCAPE from LIKE translations (#3103)
Browse files Browse the repository at this point in the history
Fixes #3085
  • Loading branch information
roji authored Feb 17, 2024
1 parent c0c962c commit 2382b8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ when patternParameter.Name.StartsWith(QueryCompilationContext.QueryParameterPref

translation = _sqlExpressionFactory.Like(
translatedInstance,
new SqlParameterExpression(escapedPatternParameter.Name!, escapedPatternParameter.Type, stringTypeMapping),
_sqlExpressionFactory.Constant(LikeEscapeChar.ToString()));
new SqlParameterExpression(escapedPatternParameter.Name!, escapedPatternParameter.Type, stringTypeMapping));

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions test/EFCore.PG.FunctionalTests/Query/CitextQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void StartsWith_param_pattern()

SELECT s."Id", s."CaseInsensitiveText"
FROM "SomeEntities" AS s
WHERE s."CaseInsensitiveText" LIKE @__param_0_startswith ESCAPE '\'
WHERE s."CaseInsensitiveText" LIKE @__param_0_startswith
LIMIT 2
""");
}
Expand Down Expand Up @@ -102,7 +102,7 @@ public void EndsWith_param_pattern()

SELECT s."Id", s."CaseInsensitiveText"
FROM "SomeEntities" AS s
WHERE s."CaseInsensitiveText" LIKE @__param_0_endswith ESCAPE '\'
WHERE s."CaseInsensitiveText" LIKE @__param_0_endswith
LIMIT 2
""");
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public void Contains_param_pattern()

SELECT s."Id", s."CaseInsensitiveText"
FROM "SomeEntities" AS s
WHERE s."CaseInsensitiveText" LIKE @__param_0_contains ESCAPE '\'
WHERE s."CaseInsensitiveText" LIKE @__param_0_contains
LIMIT 2
""");
}
Expand Down

0 comments on commit 2382b8b

Please sign in to comment.