Skip to content
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

ExecuteUpdate: handle queries failing due to invalid references to main table #2478

Closed
roji opened this issue Aug 23, 2022 · 2 comments · Fixed by #2554
Closed

ExecuteUpdate: handle queries failing due to invalid references to main table #2478

roji opened this issue Aug 23, 2022 · 2 comments · Fixed by #2554
Assignees
Labels
bug Something isn't working
Milestone

Comments

@roji
Copy link
Member

roji commented Aug 23, 2022

Tests Update_with_cross_join_cross_apply_set_constant, Update_with_cross_join_left_join_set_constant, Update_with_cross_join_outer_apply_set_constant.

Make these work by introducing an additional subquery join, see dotnet/efcore#28834 (review).

See conversation in #2476 (comment)

@roji roji added the bug Something isn't working label Aug 23, 2022
@roji roji added this to the 7.0.0 milestone Aug 23, 2022
@roji roji self-assigned this Aug 23, 2022
roji added a commit to roji/efcore.pg that referenced this issue Aug 23, 2022
@smitpatel
Copy link

This will require changing IsValidSelectExpressionForExecuteUpdate method.

  • By default relational converts APPLY to JOIN if there are no outer references (or they can be lifted in join predicate), so APPLY should cause it in all cases.
  • For predicate joins, need to check join condition
    • LEFT join would cause subquery join
    • INNER join can lift predicate to outer level and convert it to cross join

Look at SelectExpressionCorrelationFindingExpressionVisitor and write similar visitor to verify the outer references from the table which is being updated.

@roji
Copy link
Member Author

roji commented Aug 23, 2022

Thanks @smitpatel, will follow these instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants