Skip to content

Commit 451d1de

Browse files
committed
Fix dotnet#33947. Need to match on whether the expressions are pointing to same table, even if not the same instance
1 parent 27894e5 commit 451d1de

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/EFCore.Relational/Query/QuerySqlGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ protected override Expression VisitUpdate(UpdateExpression updateExpression)
14961496
var table = selectExpression.Tables[i];
14971497
var joinExpression = table as JoinExpressionBase;
14981498

1499-
if (ReferenceEquals(updateExpression.Table, joinExpression?.Table ?? table))
1499+
if (updateExpression.Table.Alias == (joinExpression?.Table.Alias ?? table.Alias))
15001500
{
15011501
LiftPredicate(table);
15021502
continue;

test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,14 @@ public override async Task Delete_aggregate_root_when_table_sharing_with_non_own
6363

6464
public override async Task Replace_ColumnExpression_in_column_setter(bool async)
6565
{
66-
// #33947
67-
await Assert.ThrowsAsync<SqliteException>(() => base.Replace_ColumnExpression_in_column_setter(async));
66+
await base.Replace_ColumnExpression_in_column_setter(async);
6867

6968
AssertSql(
7069
"""
7170
UPDATE "OwnedCollection" AS "o0"
7271
SET "Value" = 'SomeValue'
7372
FROM "Owner" AS "o"
74-
INNER JOIN "OwnedCollection" AS "o0" ON "o"."Id" = "o0"."OwnerId"
73+
WHERE "o"."Id" = "o0"."OwnerId"
7574
""");
7675
}
7776

0 commit comments

Comments
 (0)