-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Translate Min/Max over inline collection via LEAST/GREATEST #32332
Comments
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
Closes dotnet#27794 Closes dotnet#31681 Closes dotnet#32332
As per team decision, EF will always assume the latest SQL Server is being used; this means this is a breaking change, as queries using Max() over inline collections will start breaking for users. |
@roji Interestingly, this also works on a SQL Server 2022 with a database a compat level 100:
|
Huh, yeah, that's a bit odd...! |
I think it is by design - https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level?view=sql-server-ver16#differences-between-compatibility-levels "New Transact-SQL syntax isn't gated by database compatibility level, except when they can break existing applications by creating a conflict with user Transact-SQL code. These exceptions are documented in the next sections of this article that outline the differences between specific compatibility levels." Probably OPENJSON is an exception: https://learn.microsoft.com/en-us/sql/t-sql/functions/openjson-transact-sql?view=sql-server-ver16 |
Given the following query:
Full code
EF 8.0 generates the following SQL:
We should recognize Min/Max over an inline collection, and just translate to LEAST/GREATEST:
Note that #31681 already tracks adding EF.Functions.{Least,Greatest} for users to invoke directly; this issue tracks changing the Min/Max translation.
The text was updated successfully, but these errors were encountered: