-
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
'SqlException: The multi-part identifier xxxx could not be bound' for a query scenario that was working in 2.2 that doesn't work in 3.0 #18514
Comments
My guess is this has same root cause as #17809 but simple repro. |
This indeed look like the same problem. I see the work around but it is difficult to apply in our case because we have a framework to generate/reuse expressions and it is not possible to know all the places where this problem can occur... I see that ajcvickers remove the 3.1 milestone :( Do you think it can make its way back in it? Thanks. |
…on into subuquery Issue: When converting correlation to join, we add the join key columns to projection to make sure they are always available. We had logic that if projection contains any columns then projection mapping is already applied to projection. But in above case that is incorrect. That leaves us with incorrect EntityProjection which fails in further translation as multi-part identifier could not be bound. We should always lift projectionMapping during Pushdown unless projectionMapping is applied which can be checked through type. This scenario does not work for owned/weak types due to #18519 Resolves #18514
…on into subuquery Issue: When converting correlation to join, we add the join key columns to projection to make sure they are always available. We had logic that if projection contains any columns then projection mapping is already applied to projection. But in above case that is incorrect. That leaves us with incorrect EntityProjection which fails in further translation as multi-part identifier could not be bound. We should always lift projectionMapping during Pushdown unless projectionMapping is applied which can be checked through type. This scenario does not work for owned/weak types due to #18519 Resolves #18514
…on into subuquery Issue: When converting correlation to join, we add the join key columns to projection to make sure they are always available. We had logic that if projection contains any columns then projection mapping is already applied to projection. But in above case that is incorrect. That leaves us with incorrect EntityProjection which fails in further translation as multi-part identifier could not be bound. We should always lift projectionMapping during Pushdown unless projectionMapping is applied which can be checked through type. This scenario does not work for owned/weak types due to #18519 Resolves #18514
Thank you very much |
The following query was working in 2.2 but fails in 3.0. The original query is more complex that this but I narrowed it down to this:
generates the following sql:
which result with the following error: SqlException: The multi-part identifier "m.Id" could not be bound. When analyzing the generated sql, we can see that the outer apply is using m.Id from a sub query but it must use the result of that sub query: t.Id
Further technical details
EF Core version: 3.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: windows 7
IDE: Visual Studio 2019 16.3.5
The text was updated successfully, but these errors were encountered: