-
Notifications
You must be signed in to change notification settings - Fork 3.2k
GroupBy list of ranges #30425
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
Comments
In general, you're trying to perform operations involving an array parameter in your queries; while some specific patterns have good corresponding SQL constructs and can be translated, some do not. For example, I've opened npgsql/efcore.pg#2677 for a generalized approach, which would translate your array to a pseudo-table via the PostgreSQL Note that this is all highly Npgsql-specific (and so belongs in https://github.com/npgsql/efcore.pg: the Npgsql provider adds some specific functionality around PostgreSQL's support of native array types in the database. SQL Server (and other databases) do support VALUES, which can allow us to construct a table in SQL given the array parameters' values. However, that would imply embedding the values as constants in the SQL (leading to different SQLs and therefore cache query plan pollution, see #13617 for a similar case), or at least parameterizing each array element separately (leading to different SQLs for arrays of different sizes - much better but still problematic). PostgreSQL definitely has an edge here with the native array support. |
On second thought, opened #30426 to track doing this via OPENJSON for SQL Server. |
Note from triage: closing in favor of #30426. |
File a bug
I want make request to group values in ranges by local list. Something like this:
But I receive error
Additional testing shown that local list support is rather unpredictable. I don't know why requests work or don't work
Requests that don't work are commented.
Include provider and version information
EF Core version: 7.0.3
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: .NET 6.0
Operating system: Windows 10
IDE: (e.g. Visual Studio 2022 17.4)
The text was updated successfully, but these errors were encountered: