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
If the database provider is something else from PostgreSql ILIKE should do like #999
Comments
If you want to perform case-insensitive searches/comparisons, you may want to take a look at the PostgreSQL Otherwise there is currently no way to make EF.Functions.Like translate to ILIKE - the EF Core provider simply translates to LIKE, which on PostgreSQL is case-sensitive like everything else. In general EF Core doesn't exactly aim to make your code behave in an identical way across database. /cc @divega, we had this discussion some time ago. |
what about ILIKE translating to LIKE in other systems except postgresql? |
ILIKE is a PostgreSQL-specific concept that doesn't exist anywhere else - the C# function doesn't even exist in other providers... |
Am going to close this as there's nothing actionable here currently, but we can continue the conversation and possibly reopen again. |
From PostgreSQL v12 on, they allow you to use case- and accent-insensitive collations. This would be the solution... I mean that if the configured database provider is not postgresql, it should use the origin DbFunctions.Like, There is not point for ILIKE in other providers, and also there is not point in our code to write if is postgre configured, this query else other query. |
PostgreSQL v12 they say late 2019 |
Having the exact same problem here. Have to write IF ELSE for every query using ILIKE... |
@bramve-fenetre that's unfortunately not going to be possible - as written above, ILIKE is a PG-specific function, and the SQL Server provider isn't going to recognize its .NET function. You could implement an expression tree visitor which identifies calls to EF.Functions.ILike and replaces them with EF.Functions.Like when on SQL Server, though that's not completely trivial to do. |
We have a project that supports mssql, mariadb and PostgreSql.
In our c# code we use like. We want to change everywhere that we have LIKE to ILIKE so it can work as we want in PostgreSql. If we do this we see that in other dadabases it loads all rows in memory and then executes in c# the operation. It works, but not in sql level.
So, can you execute like when the providers aren't PostgreSql?
Or otherwise, is there a way EF.Functions.Like executing ILIKE in PostgreSql?
The text was updated successfully, but these errors were encountered: