-
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
LINQ query generates incorrect SQL (mismatched aliases) #24216
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
Comments
We need a runnable repro code for us to test or add a regression test for the scenario. We have fixed quite a lot of similar issues so this should be working now. |
This repo has a minimal repro. Verified incorrect SQL generation on both EF Core 5.0.4 and 6.0.0-preview.2.21154.2. |
smitpatel
added a commit
that referenced
this issue
Mar 24, 2021
- Don't apply Include on entities with Include already applied - Update table references when pushing down select into left for set operation - Update identifiers after applying set operation if the projection removed exiting identifiers - Update SQL references in pending collection during push down Fix for the repro in #17337 Resolves #18738 Resolves #19763 Resolves #19947 Resolves #20813 Resolves #21026 Resolves #22222 Resolves #23676 Resolves #23720 Resolves #24216
smitpatel
added
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
and removed
waiting-for-response
labels
Mar 24, 2021
smitpatel
added a commit
that referenced
this issue
Mar 24, 2021
- Don't apply Include on entities with Include already applied - Update table references when pushing down select into left for set operation - Update identifiers after applying set operation if the projection removed exiting identifiers - Update SQL references in pending collection during push down Fix for the repro in #17337 Resolves #18738 Resolves #19763 Resolves #19947 Resolves #20813 Resolves #21026 Resolves #22222 Resolves #23676 Resolves #23720 Resolves #24216
smitpatel
added a commit
that referenced
this issue
Mar 25, 2021
- Don't apply Include on entities with Include already applied - Update table references when pushing down select into left for set operation - Update identifiers after applying set operation if the projection removed exiting identifiers - Update SQL references in pending collection during push down Fix for the repro in #17337 Resolves #18738 Resolves #19763 Resolves #19947 Resolves #20813 Resolves #21026 Resolves #22222 Resolves #23676 Resolves #23720 Resolves #24216
smitpatel
added a commit
that referenced
this issue
Mar 25, 2021
- Don't apply Include on entities with Include already applied - Update table references when pushing down select into left for set operation - Update identifiers after applying set operation if the projection removed exiting identifiers - Update SQL references in pending collection during push down Fix for the repro in #17337 Resolves #18738 Resolves #19763 Resolves #19947 Resolves #20813 Resolves #21026 Resolves #22222 Resolves #23676 Resolves #23720 Resolves #24216
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-query
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Details
The following query generates invalid SQL:
In this query,
GetBucketMessageSurroundingContext
is a user-defined table-valued function.The SQL generated by this query is as follows:
Specifically, the issue here is that the subquery in the result gets the alias
[g]
on its join to theGender
table; the cross apply to the user-defined function uses the alias[g0]
at the point of the cross apply (presumably to avoid a conflict on the alias name), but all other references to columns returned by that function improperly refer to it with the alias[g]
.Version information
EF Core version: 5.0.3
Database provider: Microsoft.EntityFrameworkCore.SqlServer 5.0.3
Target framework: .NET 5.0
Operating system: Windows 10 19042.804
IDE: Visual Studio 2019 Professional 16.8.5
The text was updated successfully, but these errors were encountered: