Skip to content

Commit

Permalink
Fix dotnet#33947. Need to match on whether the expressions are pointi…
Browse files Browse the repository at this point in the history
…ng to same table, even if not the same instance
  • Loading branch information
ChrisJollyAU committed Sep 2, 2024
1 parent 27894e5 commit 451d1de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Query/QuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ protected override Expression VisitUpdate(UpdateExpression updateExpression)
var table = selectExpression.Tables[i];
var joinExpression = table as JoinExpressionBase;

if (ReferenceEquals(updateExpression.Table, joinExpression?.Table ?? table))
if (updateExpression.Table.Alias == (joinExpression?.Table.Alias ?? table.Alias))
{
LiftPredicate(table);
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ public override async Task Delete_aggregate_root_when_table_sharing_with_non_own

public override async Task Replace_ColumnExpression_in_column_setter(bool async)
{
// #33947
await Assert.ThrowsAsync<SqliteException>(() => base.Replace_ColumnExpression_in_column_setter(async));
await base.Replace_ColumnExpression_in_column_setter(async);

AssertSql(
"""
UPDATE "OwnedCollection" AS "o0"
SET "Value" = 'SomeValue'
FROM "Owner" AS "o"
INNER JOIN "OwnedCollection" AS "o0" ON "o"."Id" = "o0"."OwnerId"
WHERE "o"."Id" = "o0"."OwnerId"
""");
}

Expand Down

0 comments on commit 451d1de

Please sign in to comment.