Repository navigation
Get table alias out of subquery when owned entity projected with CROSS APPLY - #39424
Conversation
@dotnet-policy-service agree |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved handling for separate or split owned tables and nondeterministic test assertions must be addressed before approval.
2 open issues
What changed in this PR
This pull request fixes owned-entity projection translation in correlated SelectMany queries that generate CROSS APPLY, with provider-specific regression coverage.
Changes:
- Resolves owned-entity identifying columns against the outer select when needed.
- Adds relational regression tests for both
SelectManyoverloads. - Adds SQL Server SQL baselines and SQLite’s expected unsupported
CROSS APPLYbehavior.
| File | Description |
|---|---|
test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs |
Verifies SQL Server execution and generated SQL for both SelectMany forms. |
test/EFCore.Sqlite.FunctionalTests/Query/OwnedEntityQuerySqliteTest.cs |
Verifies SQLite reports the expected unsupported CROSS APPLY error. |
test/EFCore.Relational.Specification.Tests/Query/OwnedEntityQueryRelationalTestBase.cs |
Adds shared regression tests, model setup, and seed data for issue #35862. |
src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs |
Updates owned-entity projection resolution for correlated subqueries. |
Review effort: Lite
…th CROSS APPLY Fixes dotnet#35862
AndriySvyryd
left a comment
There was a problem hiding this comment.
Thanks for your contribution!


Fixes #35862
when use
SelectManywithout theresultSelector, the tabledof identity column from owned entity expanded inside theCROSS APPLYsubquery cannot be found from the table inside the subquery, which get thedtable reference from outside , so use the outerselectExpressionto get thedtable alias reference in this caseAdd 2 SqlServer tests. the first one use
SelectManywith bothcollectionSelectorandresultSelector, another without theresultSelectorSqlite doesn't support CROSS APPLY, add a test case for the failed message