diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index 94f7f0a4724..855be218d25 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -1271,17 +1271,17 @@ protected override Expression VisitUpdate(UpdateExpression updateExpression) _relationalCommandBuilder.Append("UPDATE "); Visit(updateExpression.Table); _relationalCommandBuilder.AppendLine(); + _relationalCommandBuilder.Append("SET "); + _relationalCommandBuilder.Append($"{_sqlGenerationHelper.DelimitIdentifier(updateExpression.ColumnValueSetters[0].Column.Name)} = "); + Visit(updateExpression.ColumnValueSetters[0].Value); using (_relationalCommandBuilder.Indent()) { - _relationalCommandBuilder.Append("SET "); - GenerateList(updateExpression.ColumnValueSetters, - e => - { - _relationalCommandBuilder.Append($"{_sqlGenerationHelper.DelimitIdentifier(e.Column.Name)} = "); - Visit(e.Value); - - }, - joinAction: e => e.AppendLine(",")); + foreach (var columnValueSetter in updateExpression.ColumnValueSetters.Skip(1)) + { + _relationalCommandBuilder.AppendLine(","); + _relationalCommandBuilder.Append($"{_sqlGenerationHelper.DelimitIdentifier(columnValueSetter.Column.Name)} = "); + Visit(columnValueSetter.Value); + } } var predicate = selectExpression.Predicate; diff --git a/src/EFCore.Relational/Query/SqlExpressions/UpdateExpression.cs b/src/EFCore.Relational/Query/SqlExpressions/UpdateExpression.cs index 178a63592d8..bcc39b55107 100644 --- a/src/EFCore.Relational/Query/SqlExpressions/UpdateExpression.cs +++ b/src/EFCore.Relational/Query/SqlExpressions/UpdateExpression.cs @@ -120,25 +120,21 @@ public void Print(ExpressionPrinter expressionPrinter) } expressionPrinter.AppendLine(); expressionPrinter.AppendLine($"UPDATE {Table.Name} AS {Table.Alias}"); - expressionPrinter.AppendLine("SET"); + expressionPrinter.AppendLine("SET "); + expressionPrinter.Visit(ColumnValueSetters[0].Column); + expressionPrinter.Append(" = "); + expressionPrinter.Visit(ColumnValueSetters[0].Value); using (expressionPrinter.Indent()) { - var first = true; - foreach (var columnValueSetter in ColumnValueSetters) + foreach (var columnValueSetter in ColumnValueSetters.Skip(1)) { - if (first) - { - first = false; - } - else - { - expressionPrinter.AppendLine(","); - } + expressionPrinter.AppendLine(","); expressionPrinter.Visit(columnValueSetter.Column); expressionPrinter.Append(" = "); expressionPrinter.Visit(columnValueSetter.Value); } } + expressionPrinter.AppendLine(); expressionPrinter.Visit(SelectExpression); } diff --git a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs index cc70705f98a..d7139c54d24 100644 --- a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs +++ b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Text.Json; +using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using Microsoft.EntityFrameworkCore.SqlServer.Metadata.Internal; using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; @@ -91,22 +92,23 @@ protected override Expression VisitUpdate(UpdateExpression updateExpression) GenerateTop(selectExpression); Sql.AppendLine($"{Dependencies.SqlGenerationHelper.DelimitIdentifier(updateExpression.Table.Alias)}"); + Sql.Append("SET "); + Visit(updateExpression.ColumnValueSetters[0].Column); + Sql.Append(" = "); + Visit(updateExpression.ColumnValueSetters[0].Value); + using (Sql.Indent()) { - Sql.Append("SET "); - GenerateList(updateExpression.ColumnValueSetters, - e => - { - Visit(e.Column); - Sql.Append(" = "); - Visit(e.Value); - - }, - joinAction: e => e.AppendLine(",")); - Sql.AppendLine(); + foreach (var columnValueSetter in updateExpression.ColumnValueSetters.Skip(1)) + { + Sql.AppendLine(","); + Visit(columnValueSetter.Column); + Sql.Append(" = "); + Visit(columnValueSetter.Value); + } } - Sql.Append("FROM "); + Sql.AppendLine().Append("FROM "); GenerateList(selectExpression.Tables, e => Visit(e), sql => sql.AppendLine()); if (selectExpression.Predicate != null) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqlServerTest.cs index 3f03db1c022..4bc21c44f07 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqlServerTest.cs @@ -128,7 +128,7 @@ public override async Task Update_where_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [a] - SET [a].[Name] = N'Animal' +SET [a].[Name] = N'Animal' FROM [Animals] AS [a] WHERE [a].[CountryId] = 1 AND [a].[Name] = N'Great spotted kiwi'"); } @@ -146,7 +146,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [a] - SET [a].[Name] = N'Kiwi' +SET [a].[Name] = N'Kiwi' FROM [Animals] AS [a] WHERE [a].[Discriminator] = N'Kiwi' AND [a].[CountryId] = 1 AND [a].[Name] = N'Great spotted kiwi'"); } @@ -157,7 +157,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -171,7 +171,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqlServerTest.cs index b46afb9201d..b84354e1359 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqlServerTest.cs @@ -127,7 +127,7 @@ public override async Task Update_where_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [a] - SET [a].[Name] = N'Animal' +SET [a].[Name] = N'Animal' FROM [Animals] AS [a] WHERE [a].[Name] = N'Great spotted kiwi'"); } @@ -145,7 +145,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [a] - SET [a].[Name] = N'Kiwi' +SET [a].[Name] = N'Kiwi' FROM [Animals] AS [a] WHERE [a].[Discriminator] = N'Kiwi' AND [a].[Name] = N'Great spotted kiwi'"); } @@ -156,7 +156,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -170,7 +170,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs index 42ae2dac218..943944c8aa4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs @@ -552,7 +552,7 @@ public override async Task Update_Where_set_constant_TagWith(bool async) @"-- MyUpdate UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -563,7 +563,7 @@ public override async Task Update_Where_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -574,7 +574,7 @@ public override async Task Update_Where_set_default(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = DEFAULT +SET [c].[ContactName] = DEFAULT FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -587,7 +587,7 @@ public override async Task Update_Where_parameter_set_constant(bool async) @"@__customer_0='ALFKI' (Size = 5) (DbType = StringFixedLength) UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] = @__customer_0", // @@ -602,7 +602,7 @@ FROM [Customers] AS [c] WHERE 0 = 1", // @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE 0 = 1"); } @@ -615,7 +615,7 @@ public override async Task Update_Where_set_parameter(bool async) @"@__value_0='Abc' (Size = 4000) UPDATE [c] - SET [c].[ContactName] = @__value_0 +SET [c].[ContactName] = @__value_0 FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -628,7 +628,7 @@ public override async Task Update_Where_Skip_set_constant(bool async) @"@__p_0='4' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -647,7 +647,7 @@ public override async Task Update_Where_Take_set_constant(bool async) @"@__p_0='4' UPDATE TOP(@__p_0) [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -661,7 +661,7 @@ public override async Task Update_Where_Skip_Take_set_constant(bool async) @__p_1='4' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -678,7 +678,7 @@ public override async Task Update_Where_OrderBy_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -695,7 +695,7 @@ public override async Task Update_Where_OrderBy_Skip_set_constant(bool async) @"@__p_0='4' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -714,7 +714,7 @@ public override async Task Update_Where_OrderBy_Take_set_constant(bool async) @"@__p_0='4' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT TOP(@__p_0) [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -733,7 +733,7 @@ public override async Task Update_Where_OrderBy_Skip_Take_set_constant(bool asyn @__p_1='4' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -753,7 +753,7 @@ public override async Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant @__p_1='6' UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] @@ -775,7 +775,7 @@ public override async Task Update_Where_GroupBy_aggregate_set_constant(bool asyn AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] = ( SELECT TOP(1) [o].[CustomerID] @@ -790,7 +790,7 @@ public override async Task Update_Where_GroupBy_First_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] = ( SELECT TOP(1) ( @@ -815,7 +815,7 @@ public override async Task Update_Where_GroupBy_First_set_constant_3(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 @@ -834,7 +834,7 @@ public override async Task Update_Where_Distinct_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -845,7 +845,7 @@ public override async Task Update_Where_using_navigation_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE [o] - SET [o].[OrderDate] = NULL +SET [o].[OrderDate] = NULL FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [c].[City] = N'Seattle'"); @@ -857,7 +857,7 @@ public override async Task Update_Where_using_navigation_2_set_constant(bool asy AssertExecuteUpdateSql( @"UPDATE [o] - SET [o].[Quantity] = CAST(1 AS smallint) +SET [o].[Quantity] = CAST(1 AS smallint) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] @@ -870,7 +870,7 @@ public override async Task Update_Where_SelectMany_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE [o] - SET [o].[OrderDate] = NULL +SET [o].[OrderDate] = NULL FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%'"); @@ -882,7 +882,7 @@ public override async Task Update_Where_set_property_plus_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + N'Abc' +SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + N'Abc' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -895,7 +895,7 @@ public override async Task Update_Where_set_property_plus_parameter(bool async) @"@__value_0='Abc' (Size = 4000) UPDATE [c] - SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + @__value_0 +SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + @__value_0 FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -906,7 +906,7 @@ public override async Task Update_Where_set_property_plus_property(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + [c].[CustomerID] +SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + [c].[CustomerID] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -917,7 +917,7 @@ public override async Task Update_Where_set_constant_using_ef_property(bool asyn AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -928,7 +928,7 @@ public override async Task Update_Where_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = NULL +SET [c].[ContactName] = NULL FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -955,7 +955,7 @@ public override async Task Update_Where_multiple_set(bool async) @"@__value_0='Abc' (Size = 4000) UPDATE [c] - SET [c].[City] = N'Seattle', +SET [c].[City] = N'Seattle', [c].[ContactName] = @__value_0 FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); @@ -988,7 +988,7 @@ public override async Task Update_Union_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -1007,7 +1007,7 @@ public override async Task Update_Concat_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -1026,7 +1026,7 @@ public override async Task Update_Except_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -1045,7 +1045,7 @@ public override async Task Update_Intersect_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -1064,7 +1064,7 @@ public override async Task Update_with_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] INNER JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1080,7 +1080,7 @@ public override async Task Update_with_left_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1096,7 +1096,7 @@ public override async Task Update_with_cross_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] CROSS JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1112,7 +1112,7 @@ public override async Task Update_with_cross_apply_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] CROSS APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1128,7 +1128,7 @@ public override async Task Update_with_outer_apply_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[ContactName] = N'Updated' +SET [c].[ContactName] = N'Updated' FROM [Customers] AS [c] OUTER APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1151,7 +1151,7 @@ public override async Task Update_Where_SelectMany_subquery_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE [o] - SET [o].[OrderDate] = NULL +SET [o].[OrderDate] = NULL FROM [Orders] AS [o] INNER JOIN ( SELECT [t].[OrderID], [t].[CustomerID], [t].[EmployeeID], [t].[OrderDate], [c].[CustomerID] AS [CustomerID0] @@ -1171,11 +1171,11 @@ public override async Task Update_Where_Join_set_property_from_joined_single_res AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[City] = CONVERT(varchar(11), DATEPART(year, ( - SELECT TOP(1) [o].[OrderDate] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderDate] DESC))) +SET [c].[City] = CONVERT(varchar(11), DATEPART(year, ( + SELECT TOP(1) [o].[OrderDate] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderDate] DESC))) FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -1186,7 +1186,7 @@ public override async Task Update_Where_Join_set_property_from_joined_table(bool AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[City] = [t].[City] +SET [c].[City] = [t].[City] FROM [Customers] AS [c] CROSS JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -1202,11 +1202,11 @@ public override async Task Update_Where_Join_set_property_from_joined_single_res AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[City] = CONVERT(varchar(11), DATEPART(year, ( - SELECT TOP(1) [o].[OrderDate] - FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderDate] DESC))) +SET [c].[City] = CONVERT(varchar(11), DATEPART(year, ( + SELECT TOP(1) [o].[OrderDate] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] + ORDER BY [o].[OrderDate] DESC))) FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqlServerTest.cs index 2599e995da5..8aa8fe3c054 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqlServerTest.cs @@ -122,7 +122,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [k] - SET [k].[Name] = N'Kiwi' +SET [k].[Name] = N'Kiwi' FROM [Kiwi] AS [k] WHERE [k].[CountryId] = 1 AND [k].[Name] = N'Great spotted kiwi'"); } @@ -133,7 +133,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -153,7 +153,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqlServerTest.cs index 071d1b78c3e..36188a00e19 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqlServerTest.cs @@ -122,7 +122,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [k] - SET [k].[Name] = N'Kiwi' +SET [k].[Name] = N'Kiwi' FROM [Kiwi] AS [k] WHERE [k].[Name] = N'Great spotted kiwi'"); } @@ -133,7 +133,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -153,7 +153,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs index d11df1e626e..c01a9822937 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs @@ -117,7 +117,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -134,7 +134,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs index b9b523680fd..bf4ee21df4c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs @@ -105,7 +105,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) @@ -122,7 +122,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE [c] - SET [c].[Name] = N'Monovia' +SET [c].[Name] = N'Monovia' FROM [Countries] AS [c] WHERE ( SELECT COUNT(*) diff --git a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs index 882dda1cb50..0a4d1d9fcdc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs @@ -168,7 +168,7 @@ public override async Task ExecuteUpdate_works_for_table_sharing(bool async) AssertSql( @"UPDATE [v] - SET [v].[SeatingCapacity] = 1 +SET [v].[SeatingCapacity] = 1 FROM [Vehicles] AS [v]", // @"SELECT CASE diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqliteTest.cs index dcdddef09ce..4252168b80a 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesSqliteTest.cs @@ -123,7 +123,7 @@ public override async Task Update_where_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Animals"" AS ""a"" - SET ""Name"" = 'Animal' +SET ""Name"" = 'Animal' WHERE ""a"".""CountryId"" = 1 AND ""a"".""Name"" = 'Great spotted kiwi'"); } @@ -140,7 +140,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Animals"" AS ""a"" - SET ""Name"" = 'Kiwi' +SET ""Name"" = 'Kiwi' WHERE ""a"".""Discriminator"" = 'Kiwi' AND ""a"".""CountryId"" = 1 AND ""a"".""Name"" = 'Great spotted kiwi'"); } @@ -150,7 +150,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" @@ -163,7 +163,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqliteTest.cs index b8c70262b20..d822e9007b7 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/InheritanceBulkUpdatesSqliteTest.cs @@ -122,7 +122,7 @@ public override async Task Update_where_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Animals"" AS ""a"" - SET ""Name"" = 'Animal' +SET ""Name"" = 'Animal' WHERE ""a"".""Name"" = 'Great spotted kiwi'"); } @@ -139,7 +139,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Animals"" AS ""a"" - SET ""Name"" = 'Kiwi' +SET ""Name"" = 'Kiwi' WHERE ""a"".""Discriminator"" = 'Kiwi' AND ""a"".""Name"" = 'Great spotted kiwi'"); } @@ -149,7 +149,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" @@ -162,7 +162,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs index 785289a6102..2c9c8ccb6be 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs @@ -536,7 +536,7 @@ public override async Task Update_Where_set_constant_TagWith(bool async) @"-- MyUpdate UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -546,7 +546,7 @@ public override async Task Update_Where_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -564,7 +564,7 @@ public override async Task Update_Where_parameter_set_constant(bool async) @"@__customer_0='ALFKI' (Size = 5) UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" = @__customer_0", // @"@__customer_0='ALFKI' (Size = 5) @@ -578,7 +578,7 @@ public override async Task Update_Where_parameter_set_constant(bool async) WHERE 0", // @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE 0"); } @@ -590,7 +590,7 @@ public override async Task Update_Where_set_parameter(bool async) @"@__value_0='Abc' (Size = 3) UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = @__value_0 +SET ""ContactName"" = @__value_0 WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -602,7 +602,7 @@ public override async Task Update_Where_Skip_set_constant(bool async) @"@__p_0='4' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -620,7 +620,7 @@ public override async Task Update_Where_Take_set_constant(bool async) @"@__p_0='4' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -639,7 +639,7 @@ public override async Task Update_Where_Skip_Take_set_constant(bool async) @__p_0='2' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -655,7 +655,7 @@ public override async Task Update_Where_OrderBy_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -672,7 +672,7 @@ public override async Task Update_Where_OrderBy_Skip_set_constant(bool async) @"@__p_0='4' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -691,7 +691,7 @@ public override async Task Update_Where_OrderBy_Take_set_constant(bool async) @"@__p_0='4' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -711,7 +711,7 @@ public override async Task Update_Where_OrderBy_Skip_Take_set_constant(bool asyn @__p_0='2' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -731,7 +731,7 @@ public override async Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant @__p_0='2' UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""t"".""CustomerID"", ""t"".""Address"", ""t"".""City"", ""t"".""CompanyName"", ""t"".""ContactName"", ""t"".""ContactTitle"", ""t"".""Country"", ""t"".""Fax"", ""t"".""Phone"", ""t"".""PostalCode"", ""t"".""Region"" FROM ( @@ -753,7 +753,7 @@ public override async Task Update_Where_GroupBy_aggregate_set_constant(bool asyn AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" = ( SELECT ""o"".""CustomerID"" FROM ""Orders"" AS ""o"" @@ -768,7 +768,7 @@ public override async Task Update_Where_GroupBy_First_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" = ( SELECT ( SELECT ""o0"".""CustomerID"" @@ -794,7 +794,7 @@ public override async Task Update_Where_GroupBy_First_set_constant_3(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE EXISTS ( SELECT 1 FROM ""Orders"" AS ""o"" @@ -813,7 +813,7 @@ public override async Task Update_Where_Distinct_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -823,7 +823,7 @@ public override async Task Update_Where_using_navigation_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE ""Orders"" AS ""o"" - SET ""OrderDate"" = NULL +SET ""OrderDate"" = NULL FROM ( SELECT ""o0"".""OrderID"", ""o0"".""CustomerID"", ""o0"".""EmployeeID"", ""o0"".""OrderDate"", ""c"".""CustomerID"" AS ""CustomerID0"" FROM ""Orders"" AS ""o0"" @@ -839,7 +839,7 @@ public override async Task Update_Where_using_navigation_2_set_constant(bool asy AssertExecuteUpdateSql( @"UPDATE ""Order Details"" AS ""o"" - SET ""Quantity"" = CAST(1 AS INTEGER) +SET ""Quantity"" = CAST(1 AS INTEGER) FROM ( SELECT ""o0"".""OrderID"", ""o0"".""ProductID"", ""o0"".""Discount"", ""o0"".""Quantity"", ""o0"".""UnitPrice"", ""o1"".""OrderID"" AS ""OrderID0"", ""c"".""CustomerID"" FROM ""Order Details"" AS ""o0"" @@ -856,7 +856,7 @@ public override async Task Update_Where_SelectMany_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE ""Orders"" AS ""o"" - SET ""OrderDate"" = NULL +SET ""OrderDate"" = NULL FROM ""Customers"" AS ""c"" WHERE ""c"".""CustomerID"" = ""o"".""CustomerID"" AND (""c"".""CustomerID"" LIKE 'F%')"); } @@ -867,7 +867,7 @@ public override async Task Update_Where_set_property_plus_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || 'Abc' +SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || 'Abc' WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -879,7 +879,7 @@ public override async Task Update_Where_set_property_plus_parameter(bool async) @"@__value_0='Abc' (Size = 3) UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || @__value_0 +SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || @__value_0 WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -889,7 +889,7 @@ public override async Task Update_Where_set_property_plus_property(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || ""c"".""CustomerID"" +SET ""ContactName"" = COALESCE(""c"".""ContactName"", '') || ""c"".""CustomerID"" WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -899,7 +899,7 @@ public override async Task Update_Where_set_constant_using_ef_property(bool asyn AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -909,7 +909,7 @@ public override async Task Update_Where_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = NULL +SET ""ContactName"" = NULL WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -935,7 +935,7 @@ public override async Task Update_Where_multiple_set(bool async) @"@__value_0='Abc' (Size = 3) UPDATE ""Customers"" AS ""c"" - SET ""City"" = 'Seattle', +SET ""City"" = 'Seattle', ""ContactName"" = @__value_0 WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -967,7 +967,7 @@ public override async Task Update_Union_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -986,7 +986,7 @@ public override async Task Update_Concat_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -1005,7 +1005,7 @@ public override async Task Update_Except_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -1024,7 +1024,7 @@ public override async Task Update_Intersect_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -1043,7 +1043,7 @@ public override async Task Update_with_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate"" FROM ""Orders"" AS ""o"" @@ -1058,7 +1058,7 @@ public override async Task Update_with_left_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"", ""t"".""OrderID"", ""t"".""CustomerID"" AS ""CustomerID0"", ""t"".""EmployeeID"", ""t"".""OrderDate"" FROM ""Customers"" AS ""c0"" @@ -1078,7 +1078,7 @@ public override async Task Update_with_cross_join_set_constant(bool async) AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""ContactName"" = 'Updated' +SET ""ContactName"" = 'Updated' FROM ( SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate"" FROM ""Orders"" AS ""o"" @@ -1110,7 +1110,7 @@ public override async Task Update_Where_SelectMany_subquery_set_null(bool async) AssertExecuteUpdateSql( @"UPDATE ""Orders"" AS ""o"" - SET ""OrderDate"" = NULL +SET ""OrderDate"" = NULL FROM ( SELECT ""t"".""OrderID"", ""t"".""CustomerID"", ""t"".""EmployeeID"", ""t"".""OrderDate"", ""c"".""CustomerID"" AS ""CustomerID0"" FROM ""Customers"" AS ""c"" @@ -1130,12 +1130,12 @@ public override async Task Update_Where_Join_set_property_from_joined_single_res AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""City"" = CAST(CAST(strftime('%Y', ( - SELECT ""o"".""OrderDate"" - FROM ""Orders"" AS ""o"" - WHERE ""c"".""CustomerID"" = ""o"".""CustomerID"" - ORDER BY ""o"".""OrderDate"" DESC - LIMIT 1)) AS INTEGER) AS TEXT) +SET ""City"" = CAST(CAST(strftime('%Y', ( + SELECT ""o"".""OrderDate"" + FROM ""Orders"" AS ""o"" + WHERE ""c"".""CustomerID"" = ""o"".""CustomerID"" + ORDER BY ""o"".""OrderDate"" DESC + LIMIT 1)) AS INTEGER) AS TEXT) WHERE ""c"".""CustomerID"" LIKE 'F%'"); } @@ -1145,7 +1145,7 @@ public override async Task Update_Where_Join_set_property_from_joined_table(bool AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""City"" = ""t"".""City"" +SET ""City"" = ""t"".""City"" FROM ( SELECT ""c0"".""CustomerID"", ""c0"".""Address"", ""c0"".""City"", ""c0"".""CompanyName"", ""c0"".""ContactName"", ""c0"".""ContactTitle"", ""c0"".""Country"", ""c0"".""Fax"", ""c0"".""Phone"", ""c0"".""PostalCode"", ""c0"".""Region"" FROM ""Customers"" AS ""c0"" @@ -1160,12 +1160,12 @@ public override async Task Update_Where_Join_set_property_from_joined_single_res AssertExecuteUpdateSql( @"UPDATE ""Customers"" AS ""c"" - SET ""City"" = CAST(CAST(strftime('%Y', ( - SELECT ""o"".""OrderDate"" - FROM ""Orders"" AS ""o"" - WHERE ""c"".""CustomerID"" = ""o"".""CustomerID"" - ORDER BY ""o"".""OrderDate"" DESC - LIMIT 1)) AS INTEGER) AS TEXT) +SET ""City"" = CAST(CAST(strftime('%Y', ( + SELECT ""o"".""OrderDate"" + FROM ""Orders"" AS ""o"" + WHERE ""c"".""CustomerID"" = ""o"".""CustomerID"" + ORDER BY ""o"".""OrderDate"" DESC + LIMIT 1)) AS INTEGER) AS TEXT) WHERE ""c"".""CustomerID"" LIKE 'F%'"); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqliteTest.cs index 8124cee18f7..6cf9f617ce1 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesSqliteTest.cs @@ -119,7 +119,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Kiwi"" AS ""k"" - SET ""Name"" = 'Kiwi' +SET ""Name"" = 'Kiwi' WHERE ""k"".""CountryId"" = 1 AND ""k"".""Name"" = 'Great spotted kiwi'"); } @@ -129,7 +129,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ( @@ -148,7 +148,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ( diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqliteTest.cs index f723adff3d3..c58ad0ad5b4 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesSqliteTest.cs @@ -119,7 +119,7 @@ public override async Task Update_where_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Kiwi"" AS ""k"" - SET ""Name"" = 'Kiwi' +SET ""Name"" = 'Kiwi' WHERE ""k"".""Name"" = 'Great spotted kiwi'"); } @@ -129,7 +129,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ( @@ -148,7 +148,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ( diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs index c19e0492324..b15a43d4429 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs @@ -117,7 +117,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" @@ -133,7 +133,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs index 7182b55da68..ea2adf71afc 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs @@ -105,7 +105,7 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" @@ -121,7 +121,7 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( @"UPDATE ""Countries"" AS ""c"" - SET ""Name"" = 'Monovia' +SET ""Name"" = 'Monovia' WHERE ( SELECT COUNT(*) FROM ""Animals"" AS ""a"" diff --git a/test/EFCore.Sqlite.FunctionalTests/TableSplittingSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/TableSplittingSqliteTest.cs index 8eebeab0e48..2d07c9edd5b 100644 --- a/test/EFCore.Sqlite.FunctionalTests/TableSplittingSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/TableSplittingSqliteTest.cs @@ -18,7 +18,7 @@ public override async Task ExecuteUpdate_works_for_table_sharing(bool async) AssertSql( @"UPDATE ""Vehicles"" AS ""v"" - SET ""SeatingCapacity"" = 1", +SET ""SeatingCapacity"" = 1", // @"SELECT NOT EXISTS ( SELECT 1