-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string.TrimStart not working in where #22924
Comments
AFAIK there isn't a function we can translate this to on SQL Server - LTRIM only works on whitespace (no characters argument). It may be possible to hack something very complicated, but which would be bad for perf. |
@InspiringCode thanks for pointing to the new version of LTRIM - I'm reopening this issue. I'm not sure it makes sense to have special logic distinguishing the SQL Server versions in EF for this case - just generating the SQL may be enough; it would fail on older versions, but that doesn't seem really worse than EF throwing "can't translate"... |
Was this ever resolved? I'm also interested in using TrimStart() with a characters parameters and having it translate to LTRIM(characters) in SQL with Entity Framework. |
Look like I forgot to actually reopen this... This should be a pretty easy issue to implement, if someone wants to take a stab at it. |
This might regress use of TrimStart(char) in final projection |
@stevendarby that's true. Since we introduced the SQL Server compatibility level config option to EF Core 8.0, it should indeed be quite easy to check that when deciding whether to translate, and refraining from translating for older targeted versions. |
I have been working in this issue. I already figured out how to verify the compatibility level in the Translator (I hope it's okay) but since the test are failing maybe I should check the compatibility level in the test too. Is that so? If yes, I don't see any other test doing that check. How I can manage that? |
@abdielcs you can annotate the test method with [SqlServerCondition], passing SupportsFunctions2022 - take a look at other tests doing this. |
Apparently I was able to break some test in EFCore.Sqlite.FunctionalTests working only in EFCore.SqlServer and EFCore.SqlServer.FunctionalTests projects in PR #33715 . Does that make any sense? If so, I can't find a descriptive log about it. Sorry for being such a newbie. |
string.TrimStart not working in where
Using string.TrimStart inside a where close not working
(But it's work in a select)
Code
Stack traces
Provider and version information
EF Core version: 3.1.8
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.7.3
The text was updated successfully, but these errors were encountered: