-
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
Query: Selecting column from wrong table when filtering on navigation property and using skip/take #7220
Comments
(Incorrect) SQL Generated from execution: SELECT "q.Book"."ID", "q.Book.MysteryBook"."BookID", "q.Book.MysteryBook"."Hero", "q.Book.MysteryBook"."AuthorID"
FROM "Quote" AS "q"
LEFT JOIN "Book" AS "q.Book" ON "q"."BookID" = "q.Book"."ID"
LEFT JOIN "MysteryBook" AS "q.Book.MysteryBook" ON "q.Book"."ID" = "q.Book.MysteryBook"."BookID"
WHERE "q.Book.MysteryBook"."Hero" = 'Sherlock'
ORDER BY "q"."ID", "q"."BookID", "q.Book"."ID"
LIMIT @__p_1 OFFSET @__p_0 "q.Book.MysteryBook"."AuthorID" is not valid |
Assigning to 1.1.1 assuming this could be a regression we need to fix. We can reevaluate based on the repro. |
This is confirmed bug though not a regression.
Also you wouldn't need |
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#5230 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#5230 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
…ated SQL - Resolves dotnet#2341 - Resolves dotnet#5085 - Resolves dotnet#6618 - Resolves dotnet#6647 - Resolves dotnet#6782 - Resolves dotnet#7080 - Resolves dotnet#7220 - Resolves dotnet#7417 - Resolves dotnet#7497 - Resolves dotnet#7523 - Resolves dotnet#7525
Verify this is fixed when #7613 is closed. |
@smitpatel #7613 doesn't fix the general case. I added another disabled test that also needs to pass. |
- Use ProjectStarTable as default table when SelectExpression is unable to find table for querysource - Change ProjectStarAlias to ProjectStarTable - Don't bind with subquery when subquery has client side projection (fixes #7220) - Set ProjectStarTable more correctly
- Use ProjectStarTable as default table when SelectExpression is unable to find table for querysource - Change ProjectStarAlias to ProjectStarTable - Don't bind with subquery when subquery has client side projection (fixes #7220) - Set ProjectStarTable more correctly
- Use ProjectStarTable as default table when SelectExpression is unable to find table for querysource - Change ProjectStarAlias to ProjectStarTable - Don't bind with subquery when subquery has client side projection (fixes #7220) - Set ProjectStarTable more correctly
- Use ProjectStarTable as default table when SelectExpression is unable to find table for querysource - Change ProjectStarAlias to ProjectStarTable - Don't bind with subquery when subquery has client side projection (fixes #7220) - Set ProjectStarTable more correctly
- Use ProjectStarTable as default table when SelectExpression is unable to find table for querysource - Change ProjectStarAlias to ProjectStarTable - Don't bind with subquery when subquery has client side projection (fixes #7220) - Set ProjectStarTable more correctly
When filtering on a navigation property and then paging results using Skip/Take, incorrect SQL is generated. This causes a SQL exception (in both SQL Server and SQLite).
Steps to reproduce
Project that reproduces this issue can be found at: https://github.com/austinleroy/EFCore_IncorrectSQLGeneration
Source also attached to this issue.
IncorrectSQLGeneration.zip
Console application that describes this issue:
Program.cs
Context & Models
Further technical details
EF Core version: 1.1.0
Database Provider:
"Microsoft.EntityFrameworkCore.Sqlite": "1.1.0"
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0"
Operating system: Windows 10
IDE: Visual Studio 2015
The text was updated successfully, but these errors were encountered: