-
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
EF Core joining on the wrong field when using GroupBy #9481
Comments
Hi @orobert91. We are gathering information on the use of EF Core pre-release builds. You reported this issue shortly after the release of 2.0.0 RTM. It would be really helpful if you could let us know:
Thanks in advance for any feedback. Hopefully this will help us to increase the value of pre-release builds going forward. |
Hi @ajcvickers
|
@orobert91 Thanks for the feedback; much appreciated! |
Blocked on #10974 |
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation #10974 - Query: Include Collection group by reference throws exception #11245 - Query: compilation error for queries with join where the inner key is navigation #9481 - EF Core joining on the wrong field when using GroupBy - Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join, - Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end), - Improved "requires materialization" logic to correctly mark qsre projected out of subquery that is a result of nav rewrite of join/groupjoin inner key.
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation #10974 - Query: Include Collection group by reference throws exception #11245 - Query: compilation error for queries with join where the inner key is navigation #11022 - Query: GroupJoin with a complex join key fails during compilation #9481 - EF Core joining on the wrong field when using GroupBy - Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join, - Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end), - Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation #10974 - Query: Include Collection group by reference throws exception #11245 - Query: compilation error for queries with join where the inner key is navigation #11022 - Query: GroupJoin with a complex join key fails during compilation #9481 - EF Core joining on the wrong field when using GroupBy - Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join, - Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end), - Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation #10974 - Query: Include Collection group by reference throws exception #11245 - Query: compilation error for queries with join where the inner key is navigation #11022 - Query: GroupJoin with a complex join key fails during compilation #9481 - EF Core joining on the wrong field when using GroupBy - Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join, - Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end), - Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
#11288 - Query: Join/GroupJoin where key selectors are qsres or navigations fails during compilation #10974 - Query: Include Collection group by reference throws exception #11245 - Query: compilation error for queries with join where the inner key is navigation #11022 - Query: GroupJoin with a complex join key fails during compilation #9481 - EF Core joining on the wrong field when using GroupBy - Added step to the QueryOptimizer that converts entity qsre comparison to key comparisons instead for order by join and group join, - Improved logic of join/groupjoin inner key navigation rewrite to correctly handle case when navigation is the final operator (i.e. no scalar is projected at the end), - Improved "requires materialization" logic to correctly mark for materialization query sources coming from subquery join keys.
fixed in fdb8ece |
Here is probably a big bug introduced in EF Core 2.0. The database is PostgreSQL.
I have this code, which returns a result in EF Core 1.2, and gives no results in EF Core 2.0:
I have investigated the produced SQL query. The first SQL query that is produced to join Team on Sport is correct:
The second query produced to join Team on Players has an incorrect join:
EF Core makes its outermost join on Player and Sport (t1.id), which does not make any sense and obviously gives no result. Instead, it should join on Player and Team (id0). Running the query manually with the fixed SQL returns the expected record.
Also removing the
GroupBy()
clause fixes the problem. The following query produces the expected SQL query and returns the expected results:I can then GroupBy() just fine using LINQ-to-objects,
The text was updated successfully, but these errors were encountered: