diff --git a/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs deleted file mode 100644 index 0f9df2b82e7..00000000000 --- a/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.EntityFrameworkCore.TestModels.Northwind; - -namespace Microsoft.EntityFrameworkCore.Query; - -public abstract class NorthwindOperatorsQueryTestBase : QueryTestBase - where TFixture : NorthwindQueryFixtureBase, new() -{ - protected NorthwindOperatorsQueryTestBase(TFixture fixture) - : base(fixture) - { - } - - protected static ExpressionType[] BinaryArithmeticOperators { get; } = - { - ExpressionType.Add, - ExpressionType.Subtract, - ExpressionType.Multiply, - ExpressionType.Divide, - // TODO Complete... - }; - - [ConditionalTheory] - [MemberData(nameof(Get_binary_arithmetic_data))] - public virtual async Task Binary_arithmetic_operators(ExpressionType outer, ExpressionType inner) - { - var parameter = Expression.Parameter(typeof(Order), "o"); - var predicate = - Expression.Lambda>( - Expression.MakeBinary( - outer, - Expression.MakeBinary( - inner, - Expression.Property(parameter, nameof(Order.OrderID)), - Expression.Constant(8)), - Expression.Constant(9)), - parameter); - - await AssertQueryScalar( - async: true, - ss => ss.Set().Where(o => o.OrderID == 10248).Select(predicate)); - } - - public static IEnumerable Get_binary_arithmetic_data() - => from op1 in BinaryArithmeticOperators from op2 in BinaryArithmeticOperators select new object[] { op1, op2 }; - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Double_negate_on_column(bool async) - => AssertQuery( - async, - ss => ss.Set().Where(o => -(-o.OrderID) == o.OrderID), - entryCount: 830); - - // TODO: Test associativity (no parentheses on consecutive e.g. add operations) - // TODO: Test non-associativity of arithmetic operators on floating points aren't associative (because of rounding errors) - - // TODO: Move operator/precedence related here, e.g. NullSemanticsQueryTestBase.Bool_not_equal_nullable_int_HasValue, - // GearsOfWarTestBase.Negate_on_binary_expression... -} diff --git a/test/EFCore.Relational.Specification.Tests/Query/OperatorsQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/OperatorsQueryTestBase.cs index e256dd21362..3388ecc1273 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/OperatorsQueryTestBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/OperatorsQueryTestBase.cs @@ -117,7 +117,7 @@ from e2 in context.Set() } } - [ConditionalFact(Skip = "issue #30277")] + [ConditionalFact] public virtual async Task Projection_with_not_and_negation_on_integer() { var contextFactory = await InitializeAsync(seed: Seed); @@ -141,4 +141,95 @@ from e5 in context.Set() Assert.Equal(expected[i], actual[i]); } } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Negate_on_column(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e in ExpectedData.OperatorEntitiesInt + where e.Id == -e.Value + select e.Id).ToList(); + + var actual = (from e in context.Set() + where e.Id == -e.Value + select e.Id).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i], actual[i]); + } + } + + [ConditionalFact] + public virtual async Task Double_negate_on_column() + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e in ExpectedData.OperatorEntitiesInt + where -(-e.Value) == e.Value + select e.Id).ToList(); + + var actual = (from e in context.Set() + where -(-e.Value) == e.Value + select e.Id).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i], actual[i]); + } + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Negate_on_binary_expression(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e1 in ExpectedData.OperatorEntitiesInt + from e2 in ExpectedData.OperatorEntitiesInt + where -e1.Value == -(e1.Id + e2.Value) + select new { Id1 = e1.Id, Id2 = e2.Id }).ToList(); + + var actual = (from e1 in context.Set() + from e2 in context.Set() + where -e1.Value == -(e1.Id + e2.Value) + select new { Id1 = e1.Id, Id2 = e2.Id }).ToList(); + + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i].Id1, actual[i].Id1); + Assert.Equal(expected[i].Id2, actual[i].Id2); + } + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Negate_on_like_expression(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e in ExpectedData.OperatorEntitiesString + where !e.Value.StartsWith("A") + select e.Id).ToList(); + + var actual = (from e in context.Set() + where !e.Value.StartsWith("A") + select e.Id).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i], actual[i]); + } + } } diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index 66cdd9acf18..3e842503d4b 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -34,27 +34,6 @@ protected override Expression RewriteExpectedQueryExpression(Expression expected => new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings()) .Visit(expectedQueryExpression); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Negate_on_binary_expression(bool async) - => AssertQuery( - async, - ss => ss.Set().Where(s => s.Id == -(s.Id + s.Id))); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Negate_on_column(bool async) - => AssertQuery( - async, - ss => ss.Set().Where(s => s.Id == -s.Id)); - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Negate_on_like_expression(bool async) - => AssertQuery( - async, - ss => ss.Set().Where(s => !s.Name.StartsWith("us"))); - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Entity_equality_empty(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 4cc1af07172..b1317c75843 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -23,42 +23,6 @@ protected override bool CanExecuteQueryString public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -([s].[Id] + [s].[Id]) -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -[s].[Id] -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') -"""); - } - public override async Task Entity_equality_empty(bool async) { await base.Entity_equality_empty(async); @@ -2931,82 +2895,6 @@ FROM [Missions] AS [m] """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Where_AtTimeZone_datetimeoffset_constant(bool async) - { - using var context = CreateContext(); - - var query = context.Set().Where( - m => EF.Functions.AtTimeZone(m.Timeline, "UTC") == new DateTimeOffset(2, 3, 1, 13, 0, 0, TimeSpan.Zero)); - - var missions = async - ? await query.ToListAsync() - : query.ToList(); - - var mission = Assert.Single(missions); - Assert.Equal(2, mission.Id); - - AssertSql( -""" -SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE ([m].[Timeline] AT TIME ZONE 'UTC') = '0002-03-01T13:00:00.0000000+00:00' -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Where_AtTimeZone_datetimeoffset_parameter(bool async) - { - using var context = CreateContext(); - - var dateTime = new DateTimeOffset(2, 3, 1, 13, 0, 0, TimeSpan.Zero); - var timeZone = "UTC"; - var query = context.Set().Where(m => m.Timeline == EF.Functions.AtTimeZone(dateTime, timeZone)); - - var missions = async - ? await query.ToListAsync() - : query.ToList(); - - var mission = Assert.Single(missions); - Assert.Equal(2, mission.Id); - - AssertSql( -""" -@__dateTime_1='0002-03-01T13:00:00.0000000+00:00' -@__timeZone_2='UTC' (Size = 8000) (DbType = AnsiString) - -SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE [m].[Timeline] = (@__dateTime_1 AT TIME ZONE @__timeZone_2) -"""); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Where_AtTimeZone_datetimeoffset_column(bool async) - { - using var context = CreateContext(); - - var query = context.Set() - .Where(m => EF.Functions.AtTimeZone(m.Timeline, "UTC") == new DateTimeOffset(2, 3, 1, 13, 0, 0, TimeSpan.Zero)); - - var missions = async - ? await query.ToListAsync() - : query.ToList(); - - var mission = Assert.Single(missions); - Assert.Equal(2, mission.Id); - - AssertSql( -""" -SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE ([m].[Timeline] AT TIME ZONE 'UTC') = '0002-03-01T13:00:00.0000000+00:00' -"""); - } - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual async Task Where_AtTimeZone_datetime_constant(bool async) @@ -3026,7 +2914,7 @@ public virtual async Task Where_AtTimeZone_datetime_constant(bool async) """ SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] AS [m] -WHERE [m].[Timeline] = (CAST('0010-05-03T12:00:00.0000000' AS datetime2) AT TIME ZONE 'UTC') +WHERE [m].[Timeline] = CAST('0010-05-03T12:00:00.0000000' AS datetime2) AT TIME ZONE 'UTC' """); } @@ -3054,7 +2942,7 @@ public virtual async Task Where_AtTimeZone_datetime_parameter(bool async) SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] AS [m] -WHERE [m].[Timeline] = (@__dateTime_1 AT TIME ZONE @__timeZone_2) +WHERE [m].[Timeline] = @__dateTime_1 AT TIME ZONE @__timeZone_2 """); } @@ -3078,7 +2966,7 @@ public virtual async Task Where_AtTimeZone_datetime_column(bool async) """ SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] -WHERE ([t].[IssueDate] AT TIME ZONE 'UTC') = '0015-03-07T00:00:00.0000000+00:00' +WHERE [t].[IssueDate] AT TIME ZONE 'UTC' = '0015-03-07T00:00:00.0000000+00:00' """); } @@ -9297,13 +9185,13 @@ public override async Task Where_TimeOnly_IsBetween(bool async) """ SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] AS [m] -WHERE (CASE +WHERE CASE WHEN [m].[Time] >= '10:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [m].[Time] < '11:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit) +END = CAST(1 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs index cccf88395e9..0eca477540b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs @@ -812,7 +812,7 @@ public override async Task Json_collection_element_access_in_predicate_using_con """ SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') <> N'Foo' OR (JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') IS NULL) +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[0].Name') IS NULL """); } @@ -827,7 +827,7 @@ public override async Task Json_collection_element_access_in_predicate_using_var SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@__prm_0 AS nvarchar(max)) + '].Name') <> N'Foo' OR (JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@__prm_0 AS nvarchar(max)) + '].Name') IS NULL) +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@__prm_0 AS nvarchar(max)) + '].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[' + CAST(@__prm_0 AS nvarchar(max)) + '].Name') IS NULL """); } @@ -883,7 +883,7 @@ public override async Task Json_collection_element_access_in_predicate_using_Ele """ SELECT [j].[Id] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') <> N'Foo' OR (JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') IS NULL) +WHERE JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') <> N'Foo' OR JSON_VALUE([j].[OwnedCollectionRoot], '$[1].Name') IS NULL """); } @@ -1391,7 +1391,7 @@ public override async Task Json_predicate_on_default_string(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestDefaultString') <> N'MyDefaultStringInReference1' OR (JSON_VALUE([j].[Reference], '$.TestDefaultString') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestDefaultString') <> N'MyDefaultStringInReference1' OR JSON_VALUE([j].[Reference], '$.TestDefaultString') IS NULL """); } @@ -1403,7 +1403,7 @@ public override async Task Json_predicate_on_max_length_string(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestMaxLengthString') <> N'Foo' OR (JSON_VALUE([j].[Reference], '$.TestMaxLengthString') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestMaxLengthString') <> N'Foo' OR JSON_VALUE([j].[Reference], '$.TestMaxLengthString') IS NULL """); } @@ -1430,7 +1430,7 @@ public override async Task Json_predicate_on_byte(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) <> CAST(3 AS tinyint) OR (CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) <> CAST(3 AS tinyint) OR CAST(JSON_VALUE([j].[Reference], '$.TestByte') AS tinyint) IS NULL """); } @@ -1442,7 +1442,7 @@ public override async Task Json_predicate_on_character(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestCharacter') <> N'z' OR (JSON_VALUE([j].[Reference], '$.TestCharacter') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestCharacter') <> N'z' OR JSON_VALUE([j].[Reference], '$.TestCharacter') IS NULL """); } @@ -1454,7 +1454,7 @@ public override async Task Json_predicate_on_datetime(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) <> '2000-01-03T00:00:00.0000000' OR (CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) <> '2000-01-03T00:00:00.0000000' OR CAST(JSON_VALUE([j].[Reference], '$.TestDateTime') AS datetime2) IS NULL """); } @@ -1466,7 +1466,7 @@ public override async Task Json_predicate_on_datetimeoffset(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) <> '2000-01-04T00:00:00.0000000+03:02' OR (CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) <> '2000-01-04T00:00:00.0000000+03:02' OR CAST(JSON_VALUE([j].[Reference], '$.TestDateTimeOffset') AS datetimeoffset) IS NULL """); } @@ -1478,7 +1478,7 @@ public override async Task Json_predicate_on_decimal(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) <> 1.35 OR (CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) <> 1.35 OR CAST(JSON_VALUE([j].[Reference], '$.TestDecimal') AS decimal(18,3)) IS NULL """); } @@ -1490,7 +1490,7 @@ public override async Task Json_predicate_on_double(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) <> 33.25E0 OR (CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) <> 33.25E0 OR CAST(JSON_VALUE([j].[Reference], '$.TestDouble') AS float) IS NULL """); } @@ -1502,7 +1502,7 @@ public override async Task Json_predicate_on_enum(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestEnum') <> N'Two' OR (JSON_VALUE([j].[Reference], '$.TestEnum') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestEnum') <> N'Two' OR JSON_VALUE([j].[Reference], '$.TestEnum') IS NULL """); } @@ -1514,7 +1514,7 @@ public override async Task Json_predicate_on_enumwithintconverter(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) <> 2 OR (CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) <> 2 OR CAST(JSON_VALUE([j].[Reference], '$.TestEnumWithIntConverter') AS int) IS NULL """); } @@ -1526,7 +1526,7 @@ public override async Task Json_predicate_on_guid(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestGuid') AS uniqueidentifier) <> '00000000-0000-0000-0000-000000000000' OR (CAST(JSON_VALUE([j].[Reference], '$.TestGuid') AS uniqueidentifier) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestGuid') AS uniqueidentifier) <> '00000000-0000-0000-0000-000000000000' OR CAST(JSON_VALUE([j].[Reference], '$.TestGuid') AS uniqueidentifier) IS NULL """); } @@ -1538,7 +1538,7 @@ public override async Task Json_predicate_on_int16(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) <> CAST(3 AS smallint) OR (CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) <> CAST(3 AS smallint) OR CAST(JSON_VALUE([j].[Reference], '$.TestInt16') AS smallint) IS NULL """); } @@ -1550,7 +1550,7 @@ public override async Task Json_predicate_on_int32(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) <> 33 OR (CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) <> 33 OR CAST(JSON_VALUE([j].[Reference], '$.TestInt32') AS int) IS NULL """); } @@ -1562,7 +1562,7 @@ public override async Task Json_predicate_on_int64(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) <> CAST(333 AS bigint) OR (CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) <> CAST(333 AS bigint) OR CAST(JSON_VALUE([j].[Reference], '$.TestInt64') AS bigint) IS NULL """); } @@ -1574,7 +1574,7 @@ public override async Task Json_predicate_on_nullableenum1(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnum') <> N'One' OR (JSON_VALUE([j].[Reference], '$.TestNullableEnum') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnum') <> N'One' OR JSON_VALUE([j].[Reference], '$.TestNullableEnum') IS NULL """); } @@ -1598,7 +1598,7 @@ public override async Task Json_predicate_on_nullableenumwithconverter1(bool asy """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) <> 1 OR (CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) <> 1 OR CAST(JSON_VALUE([j].[Reference], '$.TestNullableEnumWithIntConverter') AS int) IS NULL """); } @@ -1622,7 +1622,7 @@ public override async Task Json_predicate_on_nullableenumwithconverterthathandle """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') <> N'One' OR (JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') IS NULL) +WHERE JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') <> N'One' OR JSON_VALUE([j].[Reference], '$.TestNullableEnumWithConverterThatHandlesNulls') IS NULL """); } @@ -1644,7 +1644,7 @@ public override async Task Json_predicate_on_nullableint321(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) <> 100 OR (CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) <> 100 OR CAST(JSON_VALUE([j].[Reference], '$.TestNullableInt32') AS int) IS NULL """); } @@ -1668,7 +1668,7 @@ public override async Task Json_predicate_on_signedbyte(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) <> CAST(100 AS smallint) OR (CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) <> CAST(100 AS smallint) OR CAST(JSON_VALUE([j].[Reference], '$.TestSignedByte') AS smallint) IS NULL """); } @@ -1680,7 +1680,7 @@ public override async Task Json_predicate_on_single(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) <> CAST(10.4 AS real) OR (CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) <> CAST(10.4 AS real) OR CAST(JSON_VALUE([j].[Reference], '$.TestSingle') AS real) IS NULL """); } @@ -1692,7 +1692,7 @@ public override async Task Json_predicate_on_timespan(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) <> '03:02:00' OR (CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) <> '03:02:00' OR CAST(JSON_VALUE([j].[Reference], '$.TestTimeSpan') AS time) IS NULL """); } @@ -1704,7 +1704,7 @@ public override async Task Json_predicate_on_unisgnedint16(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) <> 100 OR (CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) <> 100 OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt16') AS int) IS NULL """); } @@ -1716,7 +1716,7 @@ public override async Task Json_predicate_on_unsignedint32(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) <> CAST(1000 AS bigint) OR (CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) <> CAST(1000 AS bigint) OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt32') AS bigint) IS NULL """); } @@ -1728,7 +1728,7 @@ public override async Task Json_predicate_on_unsignedint64(bool async) """ SELECT [j].[Id], [j].[Collection], [j].[Reference] FROM [JsonEntitiesAllTypes] AS [j] -WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) <> 10000.0 OR (CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) IS NULL) +WHERE CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) <> 10000.0 OR CAST(JSON_VALUE([j].[Reference], '$.TestUnsignedInt64') AS decimal(20,0)) IS NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs index 4e011b10ae1..e12bc821892 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs @@ -119,7 +119,7 @@ public override async Task Average_over_default_returns_default(bool async) AssertSql( """ -SELECT AVG(CAST(([o].[OrderID] - 10248) AS float)) +SELECT AVG(CAST([o].[OrderID] - 10248 AS float)) FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 """); @@ -805,7 +805,7 @@ public override async Task Average_with_binary_expression(bool async) AssertSql( """ -SELECT AVG(CAST(([o].[OrderID] * 2) AS float)) +SELECT AVG(CAST([o].[OrderID] * 2 AS float)) FROM [Orders] AS [o] """); } @@ -827,7 +827,7 @@ public override async Task Average_with_arg_expression(bool async) AssertSql( """ -SELECT AVG(CAST(([o].[OrderID] + [o].[OrderID]) AS float)) +SELECT AVG(CAST([o].[OrderID] + [o].[OrderID] AS float)) FROM [Orders] AS [o] """); } @@ -924,10 +924,10 @@ public override async Task Average_over_max_subquery_is_client_eval(bool async) @__p_0='3' SELECT AVG(CAST(( - SELECT AVG(CAST((5 + ( + SELECT AVG(CAST(5 + ( SELECT MAX([o0].[ProductID]) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID])) AS float)) + WHERE [o].[OrderID] = [o0].[OrderID]) AS float)) FROM [Orders] AS [o] WHERE [t].[CustomerID] = [o].[CustomerID]) AS decimal(18,2))) FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs index 526d9d311f2..931fd402620 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -2298,7 +2298,7 @@ public override async Task GroupBy_with_aggregate_containing_complex_where(bool SELECT [o].[EmployeeID] AS [Key], ( SELECT MAX([o0].[OrderID]) FROM [Orders] AS [o0] - WHERE CAST([o0].[EmployeeID] AS bigint) = CAST((MAX([o].[OrderID]) * 6) AS bigint) OR ([o0].[EmployeeID] IS NULL AND MAX([o].[OrderID]) IS NULL)) AS [Max] + WHERE CAST([o0].[EmployeeID] AS bigint) = CAST(MAX([o].[OrderID]) * 6 AS bigint) OR ([o0].[EmployeeID] IS NULL AND MAX([o].[OrderID]) IS NULL)) AS [Max] FROM [Orders] AS [o] GROUP BY [o].[EmployeeID] """); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs index 03deaa0d4e1..1d68ed3f0a1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -3631,7 +3631,7 @@ public override async Task Select_expression_date_add_milliseconds_large_number_ """ @__millisecondsPerDay_0='86400000' -SELECT DATEADD(millisecond, CAST(CAST((CAST(DATEPART(millisecond, [o].[OrderDate]) AS bigint) % @__millisecondsPerDay_0) AS float) AS int), DATEADD(day, CAST(CAST((CAST(DATEPART(millisecond, [o].[OrderDate]) AS bigint) / @__millisecondsPerDay_0) AS float) AS int), [o].[OrderDate])) AS [OrderDate] +SELECT DATEADD(millisecond, CAST(CAST(CAST(DATEPART(millisecond, [o].[OrderDate]) AS bigint) % @__millisecondsPerDay_0 AS float) AS int), DATEADD(day, CAST(CAST(CAST(DATEPART(millisecond, [o].[OrderDate]) AS bigint) / @__millisecondsPerDay_0 AS float) AS int), [o].[OrderDate])) AS [OrderDate] FROM [Orders] AS [o] WHERE [o].[OrderDate] IS NOT NULL """); @@ -3643,7 +3643,7 @@ public override async Task Add_minutes_on_constant_value(bool async) AssertSql( """ -SELECT DATEADD(minute, CAST(CAST(([o].[OrderID] % 25) AS float) AS int), '1900-01-01T00:00:00.000') AS [Test] +SELECT DATEADD(minute, CAST(CAST([o].[OrderID] % 25 AS float) AS int), '1900-01-01T00:00:00.000') AS [Test] FROM [Orders] AS [o] WHERE [o].[OrderID] < 10500 ORDER BY [o].[OrderID] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs deleted file mode 100644 index a84b9dcd8c0..00000000000 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.EntityFrameworkCore.Query; - -public class NorthwindOperatorsSqlServerTest : NorthwindOperatorsQueryTestBase< - NorthwindQuerySqlServerFixture> -{ - public NorthwindOperatorsSqlServerTest( - NorthwindQuerySqlServerFixture fixture, - ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - fixture.TestSqlLoggerFactory.Clear(); - } - - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] -FROM [Orders] AS [o] -WHERE -(-[o].[OrderID]) = [o].[OrderID] -"""); - } - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); -} diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index e493fc645e9..646c2411e1e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -546,7 +546,7 @@ public override async Task Select_non_matching_value_types_from_binary_expressio AssertSql( """ -SELECT CAST(([o].[OrderID] + [o].[OrderID]) AS bigint) +SELECT CAST([o].[OrderID] + [o].[OrderID] AS bigint) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI' ORDER BY [o].[OrderID] @@ -560,7 +560,7 @@ public override async Task Select_non_matching_value_types_from_binary_expressio AssertSql( """ -SELECT CAST((CAST([o].[OrderID] AS bigint) + CAST([o].[OrderID] AS bigint)) AS smallint) +SELECT CAST(CAST([o].[OrderID] AS bigint) + CAST([o].[OrderID] AS bigint) AS smallint) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI' ORDER BY [o].[OrderID] @@ -573,7 +573,7 @@ public override async Task Select_non_matching_value_types_from_unary_expression AssertSql( """ -SELECT CAST((-[o].[OrderID]) AS bigint) +SELECT CAST(-[o].[OrderID] AS bigint) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI' ORDER BY [o].[OrderID] @@ -1430,7 +1430,7 @@ public override async Task Explicit_cast_in_arithmetic_operation_is_preserved(bo AssertSql( """ -SELECT CAST([o].[OrderID] AS decimal(18,2)) / CAST(([o].[OrderID] + 1000) AS decimal(18,2)) +SELECT CAST([o].[OrderID] AS decimal(18,2)) / CAST([o].[OrderID] + 1000 AS decimal(18,2)) FROM [Orders] AS [o] WHERE [o].[OrderID] = 10243 """); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OperatorsQuerySqlServerTest.cs index 0544ed75d6d..d09616b37c3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OperatorsQuerySqlServerTest.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.EntityFrameworkCore.TestModels.Operators; + namespace Microsoft.EntityFrameworkCore.Query; public class OperatorsQuerySqlServerTest : OperatorsQueryTestBase @@ -44,6 +46,159 @@ public override async Task Projection_with_not_and_negation_on_integer() { await base.Projection_with_not_and_negation_on_integer(); - AssertSql(""); + AssertSql( +""" +SELECT ~(-(-([o1].[Value] + [o].[Value] + CAST(2 AS bigint)))) % (-([o0].[Value] + [o0].[Value]) - [o].[Value]) +FROM [OperatorEntityLong] AS [o] +CROSS JOIN [OperatorEntityLong] AS [o0] +CROSS JOIN [OperatorEntityLong] AS [o1] +ORDER BY [o].[Id], [o0].[Id], [o1].[Id] +"""); + } + + public override async Task Negate_on_column(bool async) + { + await base.Negate_on_column(async); + + AssertSql( +""" +SELECT [o].[Id] +FROM [OperatorEntityInt] AS [o] +WHERE [o].[Id] = -[o].[Value] +"""); + } + + public override async Task Double_negate_on_column() + { + await base.Double_negate_on_column(); + + AssertSql( +""" +SELECT [o].[Id] +FROM [OperatorEntityInt] AS [o] +WHERE -(-[o].[Value]) = [o].[Value] +"""); + } + + public override async Task Negate_on_binary_expression(bool async) + { + await base.Negate_on_binary_expression(async); + + AssertSql( +""" +SELECT [o].[Id] AS [Id1], [o0].[Id] AS [Id2] +FROM [OperatorEntityInt] AS [o] +CROSS JOIN [OperatorEntityInt] AS [o0] +WHERE -[o].[Value] = -([o].[Id] + [o0].[Value]) +"""); + } + + public override async Task Negate_on_like_expression(bool async) + { + await base.Negate_on_like_expression(async); + + AssertSql( +""" +SELECT [o].[Id] +FROM [OperatorEntityString] AS [o] +WHERE [o].[Value] IS NOT NULL AND NOT ([o].[Value] LIKE N'A%') +"""); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Where_AtTimeZone_datetimeoffset_constant(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e in ExpectedData.OperatorEntitiesDateTimeOffset + where e.Value.UtcDateTime == new DateTimeOffset(2000, 1, 1, 18, 0, 0, TimeSpan.Zero) + select e.Id).ToList(); + + var actual = (from e in context.Set() + where EF.Functions.AtTimeZone(e.Value, "UTC") == new DateTimeOffset(2000, 1, 1, 18, 0, 0, TimeSpan.Zero) + select e.Id).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i], actual[i]); + } + + AssertSql( +""" +SELECT [o].[Id] +FROM [OperatorEntityDateTimeOffset] AS [o] +WHERE [o].[Value] AT TIME ZONE 'UTC' = '2000-01-01T18:00:00.0000000+00:00' +"""); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Where_AtTimeZone_datetimeoffset_parameter(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var dateTime = new DateTimeOffset(2000, 1, 1, 18, 0, 0, TimeSpan.Zero); + var timeZone = "UTC"; + + var expected = (from e in ExpectedData.OperatorEntitiesDateTimeOffset + where e.Value.UtcDateTime == dateTime + select e.Id).ToList(); + + var actual = (from e in context.Set() + where EF.Functions.AtTimeZone(e.Value, timeZone) == dateTime + select e.Id).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i], actual[i]); + } + + AssertSql( +""" +@__timeZone_1='UTC' (Size = 8000) (DbType = AnsiString) +@__dateTime_2='2000-01-01T18:00:00.0000000+00:00' + +SELECT [o].[Id] +FROM [OperatorEntityDateTimeOffset] AS [o] +WHERE [o].[Value] AT TIME ZONE @__timeZone_1 = @__dateTime_2 +"""); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Where_AtTimeZone_datetimeoffset_column(bool async) + { + var contextFactory = await InitializeAsync(seed: Seed); + using var context = contextFactory.CreateContext(); + + var expected = (from e1 in ExpectedData.OperatorEntitiesDateTimeOffset + from e2 in ExpectedData.OperatorEntitiesDateTimeOffset + where e1.Value == e2.Value.UtcDateTime + select new { Id1 = e1.Id, Id2 = e2.Id }).ToList(); + + var actual = (from e1 in context.Set() + from e2 in context.Set() + where EF.Functions.AtTimeZone(e1.Value, "UTC") == e2.Value + select new { Id1 = e1.Id, Id2 = e2.Id }).ToList(); + + Assert.Equal(expected.Count, actual.Count); + for (var i = 0; i < expected.Count; i++) + { + Assert.Equal(expected[i].Id1, actual[i].Id1); + Assert.Equal(expected[i].Id2, actual[i].Id2); + } + + AssertSql( +""" +SELECT [o].[Id] AS [Id1], [o0].[Id] AS [Id2] +FROM [OperatorEntityDateTimeOffset] AS [o] +CROSS JOIN [OperatorEntityDateTimeOffset] AS [o0] +WHERE [o].[Value] AT TIME ZONE 'UTC' = [o0].[Value] +"""); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 328aaf4a082..bfeefd43a8c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -1837,7 +1837,7 @@ FROM [Entity] AS [e] """ SELECT [e].[Id], [e].[Permission], [e].[PermissionByte], [e].[PermissionShort] FROM [Entity] AS [e] -WHERE ([e].[PermissionShort] & CAST(4 AS smallint)) = CAST(4 AS smallint) +WHERE [e].[PermissionShort] & CAST(4 AS smallint) = CAST(4 AS smallint) """); } } @@ -1872,7 +1872,7 @@ FROM [Entity] AS [e] """ SELECT [e].[Id], [e].[Permission], [e].[PermissionByte], [e].[PermissionShort] FROM [Entity] AS [e] -WHERE ([e].[PermissionByte] & [e].[PermissionByte]) = [e].[PermissionByte] +WHERE [e].[PermissionByte] & [e].[PermissionByte] = [e].[PermissionByte] """); } } @@ -4893,7 +4893,7 @@ SELECT 1 FROM [EntitiesWithQueryFilterSelfReference] AS [e0] WHERE EXISTS ( SELECT 1 - FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND ([e].[Name] <> N'Foo' OR ([e].[Name] IS NULL)) + FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND ([e].[Name] <> N'Foo' OR [e].[Name] IS NULL) """); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs index f9caf4ff008..8838471b98a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs @@ -23,42 +23,6 @@ protected override bool CanExecuteQueryString public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -([s].[Id] + [s].[Id]) -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -[s].[Id] -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') -"""); - } - public override async Task Entity_equality_empty(bool async) { await base.Entity_equality_empty(async); @@ -11819,13 +11783,13 @@ public override async Task Where_TimeOnly_IsBetween(bool async) """ SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] AS [m] -WHERE (CASE +WHERE CASE WHEN [m].[Time] >= '10:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [m].[Time] < '11:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit) +END = CAST(1 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs index 5d153af6264..24516431be4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -23,42 +23,6 @@ protected override bool CanExecuteQueryString public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -([s].[Id] + [s].[Id]) -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Id] = -[s].[Id] -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') -"""); - } - public override async Task Entity_equality_empty(bool async) { await base.Entity_equality_empty(async); @@ -10122,13 +10086,13 @@ public override async Task Where_TimeOnly_IsBetween(bool async) """ SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] AS [m] -WHERE (CASE +WHERE CASE WHEN [m].[Time] >= '10:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [m].[Time] < '11:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit) +END = CAST(1 AS bit) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index 4740048f499..87330a03c0a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -400,13 +400,13 @@ public override async Task Where_TimeOnly_IsBetween(bool async) """ SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[PeriodEnd], [m].[PeriodStart], [m].[Rating], [m].[Time], [m].[Timeline] FROM [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] -WHERE (CASE +WHERE CASE WHEN [m].[Time] >= '10:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [m].[Time] < '11:00:00' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit) +END = CAST(1 AS bit) """); } @@ -1188,18 +1188,6 @@ ELSE CAST(0 AS bit) """); } - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] -FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] -WHERE [s].[Id] = -[s].[Id] -"""); - } - public override async Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) { await base.Projecting_property_converted_to_nullable_with_addition_and_final_projection(async); @@ -1436,18 +1424,6 @@ OUTER APPLY ( """); } - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] -FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') -"""); - } - public override async Task Select_subquery_distinct_singleordefault_boolean2(bool async) { await base.Select_subquery_distinct_singleordefault_boolean2(async); @@ -2864,18 +2840,6 @@ public override async Task Correlated_collections_on_left_join_with_null_value(b """); } - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] -FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] -WHERE [s].[Id] = -([s].[Id] + [s].[Id]) -"""); - } - public override async Task Include_on_derived_entity_using_OfType(bool async) { await base.Include_on_derived_entity_using_OfType(async); diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs index df20f2232fd..cd977b647bf 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs @@ -61,7 +61,7 @@ WHERE EXISTS ( SELECT 1 FROM "Posts" AS "p0" LEFT JOIN "Blogs" AS "b" ON "p0"."BlogId" = "b"."Id" - WHERE ("b"."Title" IS NOT NULL) AND ("b"."Title" LIKE 'Arthur%') AND "p0"."Id" = "p"."Id") + WHERE "b"."Title" IS NOT NULL AND "b"."Title" LIKE 'Arthur%' AND "p0"."Id" = "p"."Id") """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs index da91ed756f4..2a26d73e087 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.EntityFrameworkCore.Sqlite.Internal; -using Microsoft.EntityFrameworkCore.TestModels.Northwind; namespace Microsoft.EntityFrameworkCore.BulkUpdates; @@ -217,7 +216,7 @@ DELETE FROM "Order Details" AS "o" SELECT ( SELECT "o1"."OrderID" FROM "Orders" AS "o1" - WHERE "o0"."CustomerID" = "o1"."CustomerID" OR (("o0"."CustomerID" IS NULL) AND ("o1"."CustomerID" IS NULL)) + WHERE "o0"."CustomerID" = "o1"."CustomerID" OR ("o0"."CustomerID" IS NULL AND "o1"."CustomerID" IS NULL) LIMIT 1) FROM "Orders" AS "o0" GROUP BY "o0"."CustomerID" @@ -244,7 +243,7 @@ GROUP BY "o2"."CustomerID" HAVING COUNT(*) > 9 AND ( SELECT "o3"."OrderID" FROM "Orders" AS "o3" - WHERE "o2"."CustomerID" = "o3"."CustomerID" OR (("o2"."CustomerID" IS NULL) AND ("o3"."CustomerID" IS NULL)) + WHERE "o2"."CustomerID" = "o3"."CustomerID" OR ("o2"."CustomerID" IS NULL AND "o3"."CustomerID" IS NULL) LIMIT 1) = "o1"."OrderID") AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") """); } @@ -362,7 +361,7 @@ SELECT 1 FROM "Order Details" AS "o0" INNER JOIN "Orders" AS "o1" ON "o0"."OrderID" = "o1"."OrderID" LEFT JOIN "Customers" AS "c" ON "o1"."CustomerID" = "c"."CustomerID" - WHERE ("c"."CustomerID" IS NOT NULL) AND ("c"."CustomerID" LIKE 'F%') AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") + WHERE "c"."CustomerID" IS NOT NULL AND "c"."CustomerID" LIKE 'F%' AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") """); } @@ -505,7 +504,7 @@ SELECT 1 FROM "Order Details" AS "o0" INNER JOIN "Orders" AS "o1" ON "o0"."OrderID" = "o1"."OrderID" LEFT JOIN "Customers" AS "c" ON "o1"."CustomerID" = "c"."CustomerID" - WHERE ("c"."City" IS NOT NULL) AND ("c"."City" LIKE 'Se%') AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") + WHERE "c"."City" IS NOT NULL AND "c"."City" LIKE 'Se%' AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") """); } @@ -900,7 +899,7 @@ public override async Task Update_Where_GroupBy_First_set_constant(bool async) SELECT ( SELECT "o0"."CustomerID" FROM "Orders" AS "o0" - WHERE "o"."CustomerID" = "o0"."CustomerID" OR (("o"."CustomerID" IS NULL) AND ("o0"."CustomerID" IS NULL)) + WHERE "o"."CustomerID" = "o0"."CustomerID" OR ("o"."CustomerID" IS NULL AND "o0"."CustomerID" IS NULL) LIMIT 1) FROM "Orders" AS "o" GROUP BY "o"."CustomerID" @@ -932,7 +931,7 @@ HAVING COUNT(*) > 11 AND ( SELECT "c0"."CustomerID" FROM "Orders" AS "o0" LEFT JOIN "Customers" AS "c0" ON "o0"."CustomerID" = "c0"."CustomerID" - WHERE "o"."CustomerID" = "o0"."CustomerID" OR (("o"."CustomerID" IS NULL) AND ("o0"."CustomerID" IS NULL)) + WHERE "o"."CustomerID" = "o0"."CustomerID" OR ("o"."CustomerID" IS NULL AND "o0"."CustomerID" IS NULL) LIMIT 1) = "c"."CustomerID") """); } @@ -990,7 +989,7 @@ public override async Task Update_Where_SelectMany_set_null(bool async) UPDATE "Orders" AS "o" SET "OrderDate" = NULL FROM "Customers" AS "c" -WHERE "c"."CustomerID" = "o"."CustomerID" AND ("c"."CustomerID" LIKE 'F%') +WHERE "c"."CustomerID" = "o"."CustomerID" AND "c"."CustomerID" LIKE 'F%' """); } @@ -1203,7 +1202,7 @@ public override async Task Update_with_join_set_constant(bool async) FROM "Orders" AS "o" WHERE "o"."OrderID" < 10300 ) AS "t" -WHERE "c"."CustomerID" = "t"."CustomerID" AND ("c"."CustomerID" LIKE 'F%') +WHERE "c"."CustomerID" = "t"."CustomerID" AND "c"."CustomerID" LIKE 'F%' """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs index 142915be1ec..396a55f3bd5 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs @@ -60,7 +60,7 @@ SELECT COUNT(*) LEFT JOIN "Birds" AS "b" ON "a"."Id" = "b"."Id" LEFT JOIN "Eagle" AS "e" ON "a"."Id" = "e"."Id" LEFT JOIN "Kiwi" AS "k" ON "a"."Id" = "k"."Id" - WHERE "a"."CountryId" = 1 AND "c"."Id" = "a"."CountryId" AND ("k"."Id" IS NOT NULL) AND "a"."CountryId" > 0) > 0 + WHERE "a"."CountryId" = 1 AND "c"."Id" = "a"."CountryId" AND "k"."Id" IS NOT NULL AND "a"."CountryId" > 0) > 0 """); } @@ -152,7 +152,7 @@ SELECT COUNT(*) LEFT JOIN "Birds" AS "b" ON "a"."Id" = "b"."Id" LEFT JOIN "Eagle" AS "e" ON "a"."Id" = "e"."Id" LEFT JOIN "Kiwi" AS "k" ON "a"."Id" = "k"."Id" - WHERE "a"."CountryId" = 1 AND "c"."Id" = "a"."CountryId" AND ("k"."Id" IS NOT NULL) AND "a"."CountryId" > 0) > 0 + WHERE "a"."CountryId" = 1 AND "c"."Id" = "a"."CountryId" AND "k"."Id" IS NOT NULL AND "a"."CountryId" > 0) > 0 """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs index 198a330eca4..6b974b76140 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs @@ -134,7 +134,7 @@ SELECT COUNT(*) LEFT JOIN "Birds" AS "b" ON "a"."Id" = "b"."Id" LEFT JOIN "Eagle" AS "e" ON "a"."Id" = "e"."Id" LEFT JOIN "Kiwi" AS "k" ON "a"."Id" = "k"."Id" - WHERE "c"."Id" = "a"."CountryId" AND ("k"."Id" IS NOT NULL) AND "a"."CountryId" > 0) > 0 + WHERE "c"."Id" = "a"."CountryId" AND "k"."Id" IS NOT NULL AND "a"."CountryId" > 0) > 0 """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs index f8494ba5bc0..e94b8a9c352 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs @@ -346,42 +346,6 @@ public override async Task Correlated_collections_with_Distinct(bool async) AssertSql(); } - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -("s"."Id" + "s"."Id") -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -"s"."Id" -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE ("s"."Name" IS NOT NULL) AND NOT ("s"."Name" LIKE 'us%') -"""); - } - public override async Task Select_datetimeoffset_comparison_in_projection(bool async) { await base.Select_datetimeoffset_comparison_in_projection(async); @@ -732,7 +696,7 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs SELECT "g"."SquadId" AS "Id" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL """); } @@ -840,13 +804,13 @@ public override async Task Include_where_list_contains_navigation2(bool async) SELECT "t"."Id" FROM "Tags" AS "t" """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Gears" AS "g" INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE ("c"."Location" IS NOT NULL) AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') +WHERE "c"."Location" IS NOT NULL AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') """); } @@ -857,7 +821,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( """ SELECT CASE - WHEN ("g"."Nickname" IS NOT NULL) AND ("g"."SquadId" IS NOT NULL) THEN "g"."HasSoulPatch" + WHEN "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL THEN "g"."HasSoulPatch" ELSE 0 END AS "Prop" FROM "Tags" AS "t" @@ -894,7 +858,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_a LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -995,7 +959,7 @@ public override async Task Nullable_bool_comparison_is_translated_to_server(bool AssertSql( """ -SELECT "f"."Eradicated" = 1 AND ("f"."Eradicated" IS NOT NULL) AS "IsEradicated" +SELECT "f"."Eradicated" = 1 AND "f"."Eradicated" IS NOT NULL AS "IsEradicated" FROM "Factions" AS "f" """); } @@ -1011,10 +975,10 @@ public override async Task Null_propagation_optimization6(bool async) WHERE CASE WHEN "g"."LeaderNickname" IS NOT NULL THEN length("g"."LeaderNickname") ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN "g"."LeaderNickname" IS NOT NULL THEN length("g"."LeaderNickname") ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1074,7 +1038,7 @@ public override async Task Correlated_collections_basic_projecting_constant_bool LEFT JOIN ( SELECT 1 AS "c", "w"."Id", "w"."OwnerFullName" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -1327,7 +1291,7 @@ public override async Task OfTypeNav3(bool async) LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" INNER JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" LEFT JOIN "Tags" AS "t0" ON "g"."Nickname" = "t0"."GearNickName" AND "g"."SquadId" = "t0"."GearSquadId" -WHERE ("t"."Note" <> 'Foo' OR ("t"."Note" IS NULL)) AND "g"."Discriminator" = 'Officer' AND ("t0"."Note" <> 'Bar' OR ("t0"."Note" IS NULL)) +WHERE ("t"."Note" <> 'Foo' OR "t"."Note" IS NULL) AND "g"."Discriminator" = 'Officer' AND ("t0"."Note" <> 'Bar' OR "t0"."Note" IS NULL) """); } @@ -1364,7 +1328,7 @@ SELECT NOT EXISTS ( SELECT 1 FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" - WHERE ("t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL)) AND NOT ("g"."HasSoulPatch")) + WHERE ("t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL) AND NOT ("g"."HasSoulPatch")) """); } @@ -1391,13 +1355,13 @@ public override async Task Where_bitwise_and_nullable_enum_with_nullable_paramet SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & @__ammunitionType_0) > 0 +WHERE "w"."AmmunitionType" & @__ammunitionType_0 > 0 """, - // -""" + // + """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & NULL) > 0 +WHERE "w"."AmmunitionType" & NULL > 0 """); } @@ -1540,7 +1504,7 @@ public override async Task Correlated_collections_basic_projection_ordered(bool LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId", "t"."Name" DESC @@ -1645,7 +1609,7 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "g"."Nickname" = 'Marcus' AND ("g"."CityOfBirthName" <> 'Ephyra' OR ("g"."CityOfBirthName" IS NULL)) +WHERE "g"."Nickname" = 'Marcus' AND ("g"."CityOfBirthName" <> 'Ephyra' OR "g"."CityOfBirthName" IS NULL) """); } @@ -1658,7 +1622,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a SELECT "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" FROM "Weapons" AS "w" LEFT JOIN "Weapons" AS "w0" ON "w"."SynergyWithId" = "w0"."Id" -ORDER BY 'Marcus'' Lancer' = "w0"."Name" AND ("w0"."Name" IS NOT NULL) +ORDER BY 'Marcus'' Lancer' = "w0"."Name" AND "w0"."Name" IS NOT NULL """); } @@ -1684,23 +1648,23 @@ public override async Task Where_with_enum_flags_parameter(bool async) SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & @__rank_0) = @__rank_0 +WHERE "g"."Rank" & @__rank_0 = @__rank_0 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" """, - // -""" + // + """ @__rank_0='2' (Nullable = true) SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" | @__rank_0) <> @__rank_0 +WHERE "g"."Rank" | @__rank_0 <> @__rank_0 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" WHERE 0 @@ -1833,7 +1797,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( """ -SELECT ("g0"."Nickname" IS NULL) OR ("g0"."SquadId" IS NULL), "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" +SELECT "g0"."Nickname" IS NULL OR "g0"."SquadId" IS NULL, "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" FROM "Gears" AS "g" LEFT JOIN "Gears" AS "g0" ON "g"."LeaderNickname" = "g0"."Nickname" """); @@ -1849,7 +1813,7 @@ public override async Task OfTypeNav1(bool async) FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Tags" AS "t0" ON "g"."Nickname" = "t0"."GearNickName" AND "g"."SquadId" = "t0"."GearSquadId" -WHERE ("t"."Note" <> 'Foo' OR ("t"."Note" IS NULL)) AND "g"."Discriminator" = 'Officer' AND ("t0"."Note" <> 'Bar' OR ("t0"."Note" IS NULL)) +WHERE ("t"."Note" <> 'Foo' OR "t"."Note" IS NULL) AND "g"."Discriminator" = 'Officer' AND ("t0"."Note" <> 'Bar' OR "t0"."Note" IS NULL) """); } @@ -1915,7 +1879,7 @@ public override async Task Where_has_flag_with_nullable_parameter(bool async) SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & @__parameter_0) = @__parameter_0 +WHERE "g"."Rank" & @__parameter_0 = @__parameter_0 """); } @@ -1943,7 +1907,7 @@ public override async Task Correlated_collections_basic_projecting_single_proper LEFT JOIN ( SELECT "w"."Name", "w"."Id", "w"."OwnerFullName" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -2059,19 +2023,19 @@ public override async Task Where_bitwise_and_integral(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 1) = 1 +WHERE "g"."Rank" & 1 = 1 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (CAST("g"."Rank" AS INTEGER) & 1) = 1 +WHERE CAST("g"."Rank" AS INTEGER) & 1 = 1 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (CAST("g"."Rank" AS INTEGER) & 1) = 1 +WHERE CAST("g"."Rank" AS INTEGER) & 1 = 1 """); } @@ -2081,7 +2045,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( """ -SELECT "w"."Id", NOT ("w"."IsAutomatic") AND "w"."SynergyWithId" = 1 AND ("w"."SynergyWithId" IS NOT NULL) AS "IsCartridge" +SELECT "w"."Id", NOT ("w"."IsAutomatic") AND "w"."SynergyWithId" = 1 AND "w"."SynergyWithId" IS NOT NULL AS "IsCartridge" FROM "Weapons" AS "w" """); } @@ -2143,7 +2107,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Gears" AS "g" -LEFT JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR ("w"."OwnerFullName" IS NULL) +LEFT JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR "w"."OwnerFullName" IS NULL ORDER BY "g"."Nickname", "w"."Id" """); } @@ -2200,10 +2164,10 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( SELECT "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE (CASE +WHERE CASE WHEN "t"."GearNickName" IS NOT NULL THEN "g"."Nickname" ELSE NULL -END IS NOT NULL) AND NOT (CASE +END IS NOT NULL AND NOT (CASE WHEN "t"."GearNickName" IS NOT NULL THEN "g"."HasSoulPatch" ELSE NULL END) @@ -2219,19 +2183,19 @@ public override async Task Where_enum_has_flag_subquery_client_eval(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & ( +WHERE "g"."Rank" & ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1)) = ( + LIMIT 1) = ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) OR (( + LIMIT 1) OR ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) IS NULL) + LIMIT 1) IS NULL """); } @@ -2424,7 +2388,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cont SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE ("t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL)) AND EXISTS ( +WHERE ("t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL) AND EXISTS ( SELECT 1 FROM "Gears" AS "g0" WHERE "g0"."SquadId" = "g"."SquadId") @@ -2475,7 +2439,7 @@ CROSS JOIN "Squads" AS "s" LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" LEFT JOIN ( SELECT "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" @@ -2667,7 +2631,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM "Gears" AS "g" INNER JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" INNER JOIN "Tags" AS "t0" ON "g"."Nickname" = "t0"."GearNickName" -WHERE "t"."GearNickName" <> 'Cole Train' OR ("t"."GearNickName" IS NULL) +WHERE "t"."GearNickName" <> 'Cole Train' OR "t"."GearNickName" IS NULL ORDER BY "g"."Nickname", "t0"."Id" """); } @@ -2681,10 +2645,10 @@ public override async Task Projecting_property_converted_to_nullable_with_additi SELECT "t"."Note", "t"."GearNickName" IS NOT NULL, "g"."Nickname", "g"."SquadId", "g"."HasSoulPatch" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE (CASE +WHERE CASE WHEN "t"."GearNickName" IS NOT NULL THEN "g"."SquadId" ELSE NULL -END + 1) = 2 +END + 1 = 2 """); } @@ -2765,7 +2729,7 @@ public override async Task Contains_on_nullable_array_produces_correct_sql(bool SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" LEFT JOIN "Cities" AS "c" ON "g"."AssignedCityName" = "c"."Name" -WHERE "g"."SquadId" < 2 AND ("c"."Name" = 'Ephyra' OR ("c"."Name" IS NULL)) +WHERE "g"."SquadId" < 2 AND ("c"."Name" = 'Ephyra' OR "c"."Name" IS NULL) """); } @@ -2823,10 +2787,10 @@ ELSE NULL WHERE CASE WHEN "f"."Name" = 'Locust' THEN 1 ELSE NULL -END <> 1 OR (CASE +END <> 1 OR CASE WHEN "f"."Name" = 'Locust' THEN 1 ELSE NULL -END IS NULL) +END IS NULL """); } @@ -2877,7 +2841,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & NULL) > 0 +WHERE "w"."AmmunitionType" & NULL > 0 """); } @@ -2998,7 +2962,7 @@ LEFT JOIN ( FROM "LocustLeaders" AS "l" WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" -WHERE "c"."Name" <> 'Foo' OR ("c"."Name" IS NULL) +WHERE "c"."Name" <> 'Foo' OR "c"."Name" IS NULL """); } @@ -3011,7 +2975,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL ORDER BY "g"."SquadId" """); } @@ -3049,7 +3013,7 @@ public override async Task Enum_array_contains(bool async) SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" LEFT JOIN "Weapons" AS "w0" ON "w"."SynergyWithId" = "w0"."Id" -WHERE ("w0"."Id" IS NOT NULL) AND ("w0"."AmmunitionType" = 1 OR ("w0"."AmmunitionType" IS NULL)) +WHERE "w0"."Id" IS NOT NULL AND ("w0"."AmmunitionType" = 1 OR "w0"."AmmunitionType" IS NULL) """); } @@ -3088,7 +3052,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo SELECT COALESCE(SUM("g"."SquadId"), 0) FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE "t"."Note" <> 'Foo' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'Foo' OR "t"."Note" IS NULL """); } @@ -3144,7 +3108,7 @@ ELSE NULL END FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -LEFT JOIN "Tags" AS "t0" ON ("g"."Nickname" = "t0"."GearNickName" OR (("g"."Nickname" IS NULL) AND ("t0"."GearNickName" IS NULL))) AND ("g"."SquadId" = "t0"."GearSquadId" OR (("g"."SquadId" IS NULL) AND ("t0"."GearSquadId" IS NULL))) +LEFT JOIN "Tags" AS "t0" ON ("g"."Nickname" = "t0"."GearNickName" OR ("g"."Nickname" IS NULL AND "t0"."GearNickName" IS NULL)) AND ("g"."SquadId" = "t0"."GearSquadId" OR ("g"."SquadId" IS NULL AND "t0"."GearSquadId" IS NULL)) LEFT JOIN "Gears" AS "g0" ON "t0"."GearNickName" = "g0"."Nickname" AND "t0"."GearSquadId" = "g0"."SquadId" LEFT JOIN "Cities" AS "c" ON "g0"."AssignedCityName" = "c"."Name" """); @@ -3191,7 +3155,7 @@ public override async Task Optional_navigation_type_compensation_works_with_nega SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE ("t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL)) AND NOT ("g"."HasSoulPatch") +WHERE ("t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL) AND NOT ("g"."HasSoulPatch") """); } @@ -3289,7 +3253,7 @@ public override async Task Null_propagation_optimization2(bool async) FROM "Gears" AS "g" WHERE CASE WHEN "g"."LeaderNickname" IS NULL THEN NULL - ELSE ("g"."LeaderNickname" IS NOT NULL) AND ("g"."LeaderNickname" LIKE '%us') + ELSE "g"."LeaderNickname" IS NOT NULL AND "g"."LeaderNickname" LIKE '%us' END = 1 """); } @@ -3326,7 +3290,7 @@ LEFT JOIN ( FROM "Gears" AS "g0" ) AS "t1" WHERE "t1"."row" <= 50 -) AS "t0" ON ("g"."Nickname" = "t0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("t0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "t0"."LeaderSquadId" +) AS "t0" ON ("g"."Nickname" = "t0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "t0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "t0"."LeaderSquadId" WHERE "g"."Discriminator" = 'Officer' ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId", "t0"."Nickname" """); @@ -3395,7 +3359,7 @@ public override async Task FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Squads" AS "s" ON "g"."SquadId" = "s"."Id" -WHERE substr("t"."Note", 0 + 1, length("s"."Name")) = "t"."GearNickName" OR ((("t"."Note" IS NULL) OR ("s"."Name" IS NULL)) AND ("t"."GearNickName" IS NULL)) +WHERE substr("t"."Note", 0 + 1, length("s"."Name")) = "t"."GearNickName" OR (("t"."Note" IS NULL OR "s"."Name" IS NULL) AND "t"."GearNickName" IS NULL) """); } @@ -3669,12 +3633,12 @@ public override async Task Navigation_accessed_twice_outside_and_inside_subquery SELECT "t"."Id" FROM "Tags" AS "t" """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE ("t"."Id" IS NOT NULL) AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') +WHERE "t"."Id" IS NOT NULL AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') """); } @@ -3684,7 +3648,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( """ -SELECT "w"."AmmunitionType" = 1 AND ("w"."AmmunitionType" IS NOT NULL) AND COALESCE("w"."IsAutomatic", 0) +SELECT "w"."AmmunitionType" = 1 AND "w"."AmmunitionType" IS NOT NULL AND COALESCE("w"."IsAutomatic", 0) FROM "Weapons" AS "w" """); } @@ -3766,9 +3730,9 @@ public override async Task Bitwise_projects_values_in_select(bool async) AssertSql( """ -SELECT ("g"."Rank" & 2) = 2 AS "BitwiseTrue", ("g"."Rank" & 2) = 4 AS "BitwiseFalse", "g"."Rank" & 2 AS "BitwiseValue" +SELECT "g"."Rank" & 2 = 2 AS "BitwiseTrue", "g"."Rank" & 2 = 4 AS "BitwiseFalse", "g"."Rank" & 2 AS "BitwiseValue" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 2) = 2 +WHERE "g"."Rank" & 2 = 2 LIMIT 1 """); } @@ -3795,7 +3759,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Gears" AS "g" -LEFT JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR ("w"."OwnerFullName" IS NULL) +LEFT JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR "w"."OwnerFullName" IS NULL """); } @@ -3934,7 +3898,7 @@ LEFT JOIN ( FROM "LocustLeaders" AS "l" WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" -WHERE ("c"."Name" <> 'Foo' OR ("c"."Name" IS NULL)) AND ("t"."Name" <> 'Bar' OR ("t"."Name" IS NULL)) +WHERE ("c"."Name" <> 'Foo' OR "c"."Name" IS NULL) AND ("t"."Name" <> 'Bar' OR "t"."Name" IS NULL) """); } @@ -4001,7 +3965,7 @@ public override async Task Optional_navigation_type_compensation_works_with_arra SELECT "g"."SquadId" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL """); } @@ -4136,12 +4100,12 @@ public override async Task FirstOrDefault_navigation_access_entity_equality_in_w FROM "Gears" AS "g" INNER JOIN "Cities" AS "c0" ON "g"."CityOfBirthName" = "c0"."Name" ORDER BY "g"."Nickname" - LIMIT 1) OR (("c"."Name" IS NULL) AND (( + LIMIT 1) OR ("c"."Name" IS NULL AND ( SELECT "c0"."Name" FROM "Gears" AS "g" INNER JOIN "Cities" AS "c0" ON "g"."CityOfBirthName" = "c0"."Name" ORDER BY "g"."Nickname" - LIMIT 1) IS NULL)) + LIMIT 1) IS NULL) """); } @@ -4159,7 +4123,7 @@ LEFT JOIN ( FROM "LocustLeaders" AS "l" WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" -WHERE ("c"."Name" <> 'Foo' OR ("c"."Name" IS NULL)) AND ("t"."Name" <> 'Bar' OR ("t"."Name" IS NULL)) +WHERE ("c"."Name" <> 'Foo' OR "c"."Name" IS NULL) AND ("t"."Name" <> 'Bar' OR "t"."Name" IS NULL) """); } @@ -4228,7 +4192,7 @@ LEFT JOIN ( SELECT "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" FROM "Weapons" AS "w" LEFT JOIN "Weapons" AS "w0" ON "w"."SynergyWithId" = "w0"."Id" -) AS "t" ON "g"."FullName" <> "t"."OwnerFullName" OR ("t"."OwnerFullName" IS NULL) +) AS "t" ON "g"."FullName" <> "t"."OwnerFullName" OR "t"."OwnerFullName" IS NULL ORDER BY "g"."Nickname", "t"."Id" """); } @@ -4301,7 +4265,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE ("g"."Nickname" IS NULL) OR ("g"."SquadId" IS NULL) +WHERE "g"."Nickname" IS NULL OR "g"."SquadId" IS NULL """); } @@ -4330,31 +4294,31 @@ public override async Task Where_enum_has_flag(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 2) = 2 +WHERE "g"."Rank" & 2 = 2 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 18) = 18 +WHERE "g"."Rank" & 18 = 18 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 1) = 1 +WHERE "g"."Rank" & 1 = 1 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 1) = 1 +WHERE "g"."Rank" & 1 = 1 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (2 & "g"."Rank") = "g"."Rank" +WHERE 2 & "g"."Rank" = "g"."Rank" """); } @@ -4366,7 +4330,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_constant(bool as """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & 1) > 0 +WHERE "w"."AmmunitionType" & 1 > 0 """); } @@ -4418,7 +4382,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ -SELECT ("g0"."Nickname" IS NOT NULL) AND ("g0"."SquadId" IS NOT NULL), "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank", "g"."Nickname", "g"."SquadId", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" +SELECT "g0"."Nickname" IS NOT NULL AND "g0"."SquadId" IS NOT NULL, "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank", "g"."Nickname", "g"."SquadId", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Gears" AS "g0" ON "g"."LeaderNickname" = "g0"."Nickname" LEFT JOIN "Weapons" AS "w" ON "g0"."FullName" = "w"."OwnerFullName" @@ -4561,7 +4525,7 @@ LEFT JOIN ( SELECT "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank", "c"."Name", "c"."Location", "c"."Nation" FROM "Gears" AS "g0" INNER JOIN "Cities" AS "c" ON "g0"."CityOfBirthName" = "c"."Name" -) AS "t" ON ("g"."Nickname" = "t"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("t"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "t"."LeaderSquadId" +) AS "t" ON ("g"."Nickname" = "t"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "t"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "t"."LeaderSquadId" ORDER BY "l"."Name", "g"."Nickname", "g"."SquadId", "t"."Nickname", "t"."SquadId" """); } @@ -4790,7 +4754,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) SELECT "g"."CityOfBirthName" AS "B" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "g"."Nickname" = 'Marcus' AND ("g"."CityOfBirthName" <> 'Ephyra' OR ("g"."CityOfBirthName" IS NULL)) +WHERE "g"."Nickname" = 'Marcus' AND ("g"."CityOfBirthName" <> 'Ephyra' OR "g"."CityOfBirthName" IS NULL) """); } @@ -4826,12 +4790,12 @@ public override async Task Include_where_list_contains_navigation(bool async) SELECT "t"."Id" FROM "Tags" AS "t" """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE ("t"."Id" IS NOT NULL) AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') +WHERE "t"."Id" IS NOT NULL AND "t"."Id" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA') """); } @@ -4895,7 +4859,7 @@ public override async Task Double_order_by_on_string_compare(bool async) """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -ORDER BY "w"."Name" = 'Marcus'' Lancer' AND ("w"."Name" IS NOT NULL), "w"."Id" +ORDER BY "w"."Name" = 'Marcus'' Lancer' AND "w"."Name" IS NOT NULL, "w"."Id" """); } @@ -4945,7 +4909,7 @@ public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & @__parameter_0) = @__parameter_0 +WHERE "g"."Rank" & @__parameter_0 = @__parameter_0 """); } @@ -4986,25 +4950,25 @@ public override async Task Where_enum_has_flag_subquery(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & COALESCE(( +WHERE "g"."Rank" & COALESCE(( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1), 0)) = COALESCE(( + LIMIT 1), 0) = COALESCE(( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" LIMIT 1), 0) """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (2 & COALESCE(( +WHERE 2 & COALESCE(( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1), 0)) = COALESCE(( + LIMIT 1), 0) = COALESCE(( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" @@ -5039,7 +5003,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT "g"."SquadId" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL """); } @@ -5098,7 +5062,7 @@ public override async Task Null_semantics_is_correctly_applied_for_function_comp SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE substr("t"."Note", 0 + 1, "g"."SquadId") = "t"."GearNickName" OR ((("t"."Note" IS NULL) OR ("g"."SquadId" IS NULL)) AND ("t"."GearNickName" IS NULL)) +WHERE substr("t"."Note", 0 + 1, "g"."SquadId") = "t"."GearNickName" OR (("t"."Note" IS NULL OR "g"."SquadId" IS NULL) AND "t"."GearNickName" IS NULL) """); } @@ -5138,7 +5102,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( """ SELECT "g0"."Nickname", CASE - WHEN ("g0"."Nickname" IS NOT NULL) AND ("g0"."SquadId" IS NOT NULL) THEN "g0"."LeaderNickname" IS NOT NULL + WHEN "g0"."Nickname" IS NOT NULL AND "g0"."SquadId" IS NOT NULL THEN "g0"."LeaderNickname" IS NOT NULL ELSE NULL END AS "Condition" FROM "Gears" AS "g" @@ -5221,7 +5185,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Gears" AS "g" -INNER JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR ("w"."OwnerFullName" IS NULL) +INNER JOIN "Weapons" AS "w" ON "g"."FullName" <> "w"."OwnerFullName" OR "w"."OwnerFullName" IS NULL ORDER BY "g"."Nickname", "w"."Id" """); } @@ -5249,7 +5213,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE ("t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL)) AND "g"."HasSoulPatch" +WHERE ("t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL) AND "g"."HasSoulPatch" """); } @@ -5300,37 +5264,37 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & ( +WHERE "g"."Rank" & ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1)) = ( + LIMIT 1) = ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) OR (( + LIMIT 1) OR ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) IS NULL) + LIMIT 1) IS NULL """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (2 & ( +WHERE 2 & ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1)) = ( + LIMIT 1) = ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) OR (( + LIMIT 1) OR ( SELECT "g0"."Rank" FROM "Gears" AS "g0" ORDER BY "g0"."Nickname", "g0"."SquadId" - LIMIT 1) IS NULL) + LIMIT 1) IS NULL """); } @@ -5347,7 +5311,7 @@ LEFT JOIN ( FROM "Factions" AS "f" WHERE "f"."Name" = 'Swarm' ) AS "t" ON "l"."Name" = "t"."CommanderName" -WHERE "t"."Eradicated" <> 1 OR ("t"."Eradicated" IS NULL) +WHERE "t"."Eradicated" <> 1 OR "t"."Eradicated" IS NULL """); } @@ -5384,7 +5348,7 @@ public override async Task Include_with_nested_navigation_in_order_by(bool async FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g" ON "w"."OwnerFullName" = "g"."FullName" LEFT JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" -WHERE "g"."Nickname" <> 'Paduk' OR ("g"."Nickname" IS NULL) +WHERE "g"."Nickname" <> 'Paduk' OR "g"."Nickname" IS NULL ORDER BY "c"."Name", "w"."Id" """); } @@ -5415,7 +5379,7 @@ INNER JOIN ( FROM "Factions" AS "f" WHERE "f"."Name" = 'Swarm' ) AS "t" ON "l"."Name" = "t"."CommanderName" -WHERE "t"."Eradicated" <> 1 OR ("t"."Eradicated" IS NULL) +WHERE "t"."Eradicated" <> 1 OR "t"."Eradicated" IS NULL """); } @@ -5522,7 +5486,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as SELECT "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" FROM "Weapons" AS "w" LEFT JOIN "Weapons" AS "w0" ON "w"."SynergyWithId" = "w0"."Id" -ORDER BY "w0"."Name" = 'Marcus'' Lancer' AND ("w0"."Name" IS NOT NULL) +ORDER BY "w0"."Name" = 'Marcus'' Lancer' AND "w0"."Name" IS NOT NULL """); } @@ -5569,7 +5533,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" WHERE "g"."Discriminator" = 'Officer' ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); @@ -5594,7 +5558,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra """ SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Tags" AS "t" -LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" AND ("t"."Note" IS NOT NULL) +LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" AND "t"."Note" IS NOT NULL ORDER BY "t"."Id", "g"."Nickname" """); } @@ -5605,7 +5569,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( """ -SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", ("g"."Nickname" IS NULL) OR ("g"."SquadId" IS NULL) AS "IsNull", "f"."Id", "f"."CapitalName", "f"."Discriminator", "f"."Name", "f"."ServerAddress", "f"."CommanderName", "f"."Eradicated", "f"."Id" IS NULL AS "IsNull", "l0"."Id", "l0"."IsOperational", "l0"."Name", "l0"."Id" IS NULL AS "IsNull" +SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "g"."Nickname" IS NULL OR "g"."SquadId" IS NULL AS "IsNull", "f"."Id", "f"."CapitalName", "f"."Discriminator", "f"."Name", "f"."ServerAddress", "f"."CommanderName", "f"."Eradicated", "f"."Id" IS NULL AS "IsNull", "l0"."Id", "l0"."IsOperational", "l0"."Name", "l0"."Id" IS NULL AS "IsNull" FROM "LocustLeaders" AS "l" LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Factions" AS "f" ON "l"."Name" = "f"."CommanderName" @@ -5639,7 +5603,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq SELECT DISTINCT "g"."HasSoulPatch" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE "t"."Note" <> 'Foo' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'Foo' OR "t"."Note" IS NULL """); } @@ -5770,13 +5734,13 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b """ SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" FROM "LocustLeaders" AS "l" -WHERE "l"."Discriminator" = 'LocustCommander' AND ("l"."HighCommandId" <> 0 OR ("l"."HighCommandId" IS NULL)) +WHERE "l"."Discriminator" = 'LocustCommander' AND ("l"."HighCommandId" <> 0 OR "l"."HighCommandId" IS NULL) """, - // -""" + // + """ SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" FROM "LocustLeaders" AS "l" -WHERE "l"."Discriminator" = 'LocustCommander' AND ("l"."HighCommandId" <> 0 OR ("l"."HighCommandId" IS NULL)) +WHERE "l"."Discriminator" = 'LocustCommander' AND ("l"."HighCommandId" <> 0 OR "l"."HighCommandId" IS NULL) """); } @@ -5801,7 +5765,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_par SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & @__ammunitionType_0) > 0 +WHERE "w"."AmmunitionType" & @__ammunitionType_0 > 0 """); } @@ -5843,13 +5807,13 @@ public override async Task Where_bitwise_and_enum(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 2) > 0 +WHERE "g"."Rank" & 2 > 0 """, - // -""" + // + """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 2) = 2 +WHERE "g"."Rank" & 2 = 2 """); } @@ -6115,7 +6079,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ -SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "g0"."Nickname", "g0"."SquadId", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId", "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "w2"."Id", "w2"."AmmunitionType", "w2"."IsAutomatic", "w2"."Name", "w2"."OwnerFullName", "w2"."SynergyWithId", ("g0"."Nickname" IS NOT NULL) AND ("g0"."SquadId" IS NOT NULL), "w3"."Id", "w3"."AmmunitionType", "w3"."IsAutomatic", "w3"."Name", "w3"."OwnerFullName", "w3"."SynergyWithId", "w4"."Id", "w4"."AmmunitionType", "w4"."IsAutomatic", "w4"."Name", "w4"."OwnerFullName", "w4"."SynergyWithId" +SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "g0"."Nickname", "g0"."SquadId", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId", "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "w2"."Id", "w2"."AmmunitionType", "w2"."IsAutomatic", "w2"."Name", "w2"."OwnerFullName", "w2"."SynergyWithId", "g0"."Nickname" IS NOT NULL AND "g0"."SquadId" IS NOT NULL, "w3"."Id", "w3"."AmmunitionType", "w3"."IsAutomatic", "w3"."Name", "w3"."OwnerFullName", "w3"."SynergyWithId", "w4"."Id", "w4"."AmmunitionType", "w4"."IsAutomatic", "w4"."Name", "w4"."OwnerFullName", "w4"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Gears" AS "g0" ON "g"."LeaderNickname" = "g0"."Nickname" LEFT JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" @@ -6174,20 +6138,20 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" & @__ranks_0) <> 0 +WHERE "g"."Rank" & @__ranks_0 <> 0 """, - // -""" + // + """ @__ranks_0='134' -SELECT ("g"."Rank" | @__ranks_0) = @__ranks_0 +SELECT "g"."Rank" | @__ranks_0 = @__ranks_0 FROM "Gears" AS "g" """, - // -""" + // + """ @__ranks_0='134' -SELECT ("g"."Rank" | ("g"."Rank" | (@__ranks_0 | ("g"."Rank" | @__ranks_0)))) = @__ranks_0 +SELECT "g"."Rank" | "g"."Rank" | @__ranks_0 | "g"."Rank" | @__ranks_0 = @__ranks_0 FROM "Gears" AS "g" """); } @@ -6315,7 +6279,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool AssertSql( """ -SELECT (("g"."FullName" || '') || COALESCE("g"."LeaderNickname", '')) || '' +SELECT "g"."FullName" || '' || COALESCE("g"."LeaderNickname", '') || '' FROM "Gears" AS "g" """); } @@ -6359,7 +6323,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_l LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -6430,7 +6394,7 @@ public override async Task Composite_key_entity_not_equal_null(bool async) SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" FROM "LocustLeaders" AS "l" LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" -WHERE "l"."Discriminator" = 'LocustCommander' AND ("g"."Nickname" IS NOT NULL) AND ("g"."SquadId" IS NOT NULL) +WHERE "l"."Discriminator" = 'LocustCommander' AND "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL """); } @@ -6615,11 +6579,11 @@ WHERE CASE SELECT "w"."Name" FROM "Weapons" AS "w" WHERE "w"."Id" = "g"."SquadId" - LIMIT 1) = @__prm2_1 AND (( + LIMIT 1) = @__prm2_1 AND ( SELECT "w"."Name" FROM "Weapons" AS "w" WHERE "w"."Id" = "g"."SquadId" - LIMIT 1) IS NOT NULL) + LIMIT 1) IS NOT NULL ELSE 0 END """); @@ -6637,7 +6601,7 @@ public override async Task Select_correlated_filtered_collection(bool async) LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."Name" <> 'Lancer' OR ("w"."Name" IS NULL) + WHERE "w"."Name" <> 'Lancer' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "c"."Name" IN ('Ephyra', 'Hanover') ORDER BY "g"."Nickname", "g"."SquadId", "c"."Name" @@ -6659,7 +6623,7 @@ LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname", "g2"."SquadId", ( SELECT COUNT(*) FROM "Weapons" AS "w0" - WHERE ("g2"."FullName" IS NOT NULL) AND "g2"."FullName" = "w0"."OwnerFullName") AS "c" + WHERE "g2"."FullName" IS NOT NULL AND "g2"."FullName" = "w0"."OwnerFullName") AS "c" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g2" ON "w"."OwnerFullName" = "g2"."FullName" ) AS "t0" ON "g1"."FullName" = "t0"."OwnerFullName" @@ -6762,7 +6726,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ -SELECT ("g"."Nickname" IS NOT NULL) AND ("g"."SquadId" IS NOT NULL), "t"."Id", "g"."Nickname", "g"."SquadId", "t0"."Nickname", "t0"."Id", "t0"."SquadId" +SELECT "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL, "t"."Id", "g"."Nickname", "g"."SquadId", "t0"."Nickname", "t0"."Id", "t0"."SquadId" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN ( @@ -6788,7 +6752,7 @@ LEFT JOIN ( WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" LEFT JOIN "Gears" AS "g" ON "t"."DefeatedByNickname" = "g"."Nickname" AND "t"."DefeatedBySquadId" = "g"."SquadId" -LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" ORDER BY "f"."Id", "t"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -6804,7 +6768,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN "Tags" AS "t0" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON "t0"."GearNickName" = "g0"."Nickname" AND "t0"."GearSquadId" = "g0"."SquadId" -WHERE "g"."Nickname" = "g0"."Nickname" OR (("g"."Nickname" IS NULL) AND ("g0"."Nickname" IS NULL)) +WHERE "g"."Nickname" = "g0"."Nickname" OR ("g"."Nickname" IS NULL AND "g0"."Nickname" IS NULL) """); } @@ -6862,7 +6826,7 @@ LEFT JOIN ( LEFT JOIN "Squads" AS "s" ON "g3"."SquadId" = "s"."Id" LEFT JOIN "Weapons" AS "w0" ON "g3"."FullName" = "w0"."OwnerFullName" LEFT JOIN "Gears" AS "g4" ON "s"."Id" = "g4"."SquadId" - WHERE "w"."Name" <> 'Bar' OR ("w"."Name" IS NULL) + WHERE "w"."Name" <> 'Bar' OR "w"."Name" IS NULL ) AS "t1" ON "g2"."FullName" = "t1"."OwnerFullName" WHERE "g2"."FullName" <> 'Foo' ) AS "t0" ON "g"."Nickname" = "t0"."LeaderNickname" AND "g"."SquadId" = "t0"."LeaderSquadId" @@ -6889,38 +6853,38 @@ public override async Task Bitwise_operation_with_null_arguments(bool async) FROM "Weapons" AS "w" WHERE "w"."AmmunitionType" IS NULL """, - // -""" + // + """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" WHERE "w"."AmmunitionType" IS NULL """, - // -""" + // + """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" WHERE "w"."AmmunitionType" IS NULL """, - // -""" + // + """ SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" """, - // -""" + // + """ @__prm_0='2' (Nullable = true) SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & @__prm_0) <> 0 OR ("w"."AmmunitionType" IS NULL) +WHERE "w"."AmmunitionType" & @__prm_0 <> 0 OR "w"."AmmunitionType" IS NULL """, - // -""" + // + """ @__prm_0='1' (Nullable = true) SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" & @__prm_0) = @__prm_0 +WHERE "w"."AmmunitionType" & @__prm_0 = @__prm_0 """); } @@ -6948,7 +6912,7 @@ public override async Task Optional_navigation_with_collection_composite_key(boo WHERE "g"."Discriminator" = 'Officer' AND ( SELECT COUNT(*) FROM "Gears" AS "g0" - WHERE ("g"."Nickname" IS NOT NULL) AND ("g"."SquadId" IS NOT NULL) AND "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId" AND "g0"."Nickname" = 'Dom') > 0 + WHERE "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL AND "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId" AND "g0"."Nickname" = 'Dom') > 0 """); } @@ -6978,7 +6942,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator" AS "Discriminator0", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "t"."Id", "t"."Note" FROM "LocustLeaders" AS "l" LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" - LEFT JOIN "Tags" AS "t" ON ("g"."Nickname" = "t"."GearNickName" OR (("g"."Nickname" IS NULL) AND ("t"."GearNickName" IS NULL))) AND ("g"."SquadId" = "t"."GearSquadId" OR (("g"."SquadId" IS NULL) AND ("t"."GearSquadId" IS NULL))) + LEFT JOIN "Tags" AS "t" ON ("g"."Nickname" = "t"."GearNickName" OR ("g"."Nickname" IS NULL AND "t"."GearNickName" IS NULL)) AND ("g"."SquadId" = "t"."GearSquadId" OR ("g"."SquadId" IS NULL AND "t"."GearSquadId" IS NULL)) ORDER BY "t"."Note" LIMIT @__p_0 ) AS "t0" @@ -7193,7 +7157,7 @@ LEFT JOIN ( FROM "Gears" AS "g" WHERE "g"."Discriminator" = 'Officer' ) AS "t0" ON "t"."GearNickName" = "t0"."Nickname" -LEFT JOIN "Gears" AS "g0" ON ("t0"."Nickname" = "g0"."LeaderNickname" OR (("t0"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "t0"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("t0"."Nickname" = "g0"."LeaderNickname" OR ("t0"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "t0"."SquadId" = "g0"."LeaderSquadId" ORDER BY "t"."Id", "t0"."Nickname", "t0"."SquadId", "g0"."Nickname" """); } @@ -7263,7 +7227,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (@__prm_0 & CAST("g"."Rank" AS INTEGER)) = CAST("g"."Rank" AS INTEGER) +WHERE @__prm_0 & CAST("g"."Rank" AS INTEGER) = CAST("g"."Rank" AS INTEGER) """); } @@ -7365,7 +7329,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( """ -SELECT ("g0"."Nickname" IS NOT NULL) AND ("g0"."SquadId" IS NOT NULL), "g0"."Nickname" +SELECT "g0"."Nickname" IS NOT NULL AND "g0"."SquadId" IS NOT NULL, "g0"."Nickname" FROM "Gears" AS "g" LEFT JOIN "Gears" AS "g0" ON "g"."HasSoulPatch" ORDER BY "g0"."Nickname" @@ -7383,10 +7347,10 @@ public override async Task Null_propagation_optimization5(bool async) WHERE CASE WHEN "g"."LeaderNickname" IS NOT NULL THEN length("g"."LeaderNickname") ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN "g"."LeaderNickname" IS NOT NULL THEN length("g"."LeaderNickname") ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -7456,7 +7420,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member SELECT "g"."Nickname" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE CAST(strftime('%m', "t"."IssueDate") AS INTEGER) <> 5 OR ("t"."IssueDate" IS NULL) +WHERE CAST(strftime('%m', "t"."IssueDate") AS INTEGER) <> 5 OR "t"."IssueDate" IS NULL ORDER BY "g"."Nickname" """); } @@ -7492,7 +7456,7 @@ LEFT JOIN ( WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" LEFT JOIN "Gears" AS "g" ON "t"."DefeatedByNickname" = "g"."Nickname" AND "t"."DefeatedBySquadId" = "g"."SquadId" -LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" ORDER BY "f"."Id", "t"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -7532,7 +7496,7 @@ public override async Task Contains_on_collection_of_nullable_byte_subquery(bool WHERE EXISTS ( SELECT 1 FROM "LocustLeaders" AS "l0" - WHERE "l0"."ThreatLevelNullableByte" = "l"."ThreatLevelNullableByte" OR (("l0"."ThreatLevelNullableByte" IS NULL) AND ("l"."ThreatLevelNullableByte" IS NULL))) + WHERE "l0"."ThreatLevelNullableByte" = "l"."ThreatLevelNullableByte" OR ("l0"."ThreatLevelNullableByte" IS NULL AND "l"."ThreatLevelNullableByte" IS NULL)) """); } @@ -7559,11 +7523,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( """ SELECT "w"."Id", CASE - WHEN ("w"."AmmunitionType" IS NOT NULL) AND "w"."AmmunitionType" = 1 THEN 'Yes' + WHEN "w"."AmmunitionType" IS NOT NULL AND "w"."AmmunitionType" = 1 THEN 'Yes' ELSE 'No' END AS "IsCartridge" FROM "Weapons" AS "w" -WHERE ("w"."AmmunitionType" IS NOT NULL) AND "w"."AmmunitionType" = 1 +WHERE "w"."AmmunitionType" IS NOT NULL AND "w"."AmmunitionType" = 1 """); } @@ -7680,7 +7644,7 @@ public override async Task Correlated_collections_basic_projecting_constant(bool LEFT JOIN ( SELECT 'BFG' AS "c", "w"."Id", "w"."OwnerFullName" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -7712,7 +7676,7 @@ public override async Task Where_bitwise_or_enum(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE ("g"."Rank" | 2) > 0 +WHERE "g"."Rank" | 2 > 0 """); } @@ -7744,7 +7708,7 @@ public override async Task Composite_key_entity_equal_null(bool async) SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" FROM "LocustLeaders" AS "l" LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" -WHERE "l"."Discriminator" = 'LocustCommander' AND (("g"."Nickname" IS NULL) OR ("g"."SquadId" IS NULL)) +WHERE "l"."Discriminator" = 'LocustCommander' AND ("g"."Nickname" IS NULL OR "g"."SquadId" IS NULL) """); } @@ -8073,7 +8037,7 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE (@__prm_0 & "g"."Rank") = "g"."Rank" +WHERE @__prm_0 & "g"."Rank" = "g"."Rank" """); } @@ -8111,12 +8075,12 @@ public override async Task Select_comparison_with_null(bool async) """ @__ammunitionType_0='1' (Nullable = true) -SELECT "w"."Id", "w"."AmmunitionType" = @__ammunitionType_0 AND ("w"."AmmunitionType" IS NOT NULL) AS "Cartridge" +SELECT "w"."Id", "w"."AmmunitionType" = @__ammunitionType_0 AND "w"."AmmunitionType" IS NOT NULL AS "Cartridge" FROM "Weapons" AS "w" WHERE "w"."AmmunitionType" = @__ammunitionType_0 """, - // -""" + // + """ SELECT "w"."Id", "w"."AmmunitionType" IS NULL AS "Cartridge" FROM "Weapons" AS "w" WHERE "w"."AmmunitionType" IS NULL @@ -8133,7 +8097,7 @@ public override async Task OfTypeNav2(bool async) FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Cities" AS "c" ON "g"."AssignedCityName" = "c"."Name" -WHERE ("t"."Note" <> 'Foo' OR ("t"."Note" IS NULL)) AND "g"."Discriminator" = 'Officer' AND ("c"."Location" <> 'Bar' OR ("c"."Location" IS NULL)) +WHERE ("t"."Note" <> 'Foo' OR "t"."Note" IS NULL) AND "g"."Discriminator" = 'Officer' AND ("c"."Location" <> 'Bar' OR "c"."Location" IS NULL) """); } @@ -8148,7 +8112,7 @@ public override async Task Correlated_collections_basic_projection(bool async) LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR ("w"."Name" IS NULL) + WHERE "w"."IsAutomatic" OR "w"."Name" <> 'foo' OR "w"."Name" IS NULL ) AS "t" ON "g"."FullName" = "t"."OwnerFullName" WHERE "g"."Nickname" <> 'Marcus' ORDER BY "g"."Nickname", "g"."SquadId" @@ -8166,10 +8130,10 @@ public override async Task Null_propagation_optimization4(bool async) WHERE CASE WHEN "g"."LeaderNickname" IS NULL THEN NULL ELSE length("g"."LeaderNickname") -END = 5 AND (CASE +END = 5 AND CASE WHEN "g"."LeaderNickname" IS NULL THEN NULL ELSE length("g"."LeaderNickname") -END IS NOT NULL) +END IS NOT NULL """); } @@ -8193,7 +8157,7 @@ public override async Task Select_Where_Navigation_Null(bool async) SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE ("g"."Nickname" IS NULL) OR ("g"."SquadId" IS NULL) +WHERE "g"."Nickname" IS NULL OR "g"."SquadId" IS NULL """); } @@ -8223,7 +8187,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( """ -SELECT ("g0"."Nickname" IS NOT NULL) AND ("g0"."SquadId" IS NOT NULL), "g0"."Nickname" +SELECT "g0"."Nickname" IS NOT NULL AND "g0"."SquadId" IS NOT NULL, "g0"."Nickname" FROM "Gears" AS "g" LEFT JOIN "Gears" AS "g0" ON "g"."HasSoulPatch" ORDER BY "g0"."Nickname" @@ -8258,7 +8222,7 @@ LEFT JOIN ( WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" LEFT JOIN "Gears" AS "g" ON "t"."DefeatedByNickname" = "g"."Nickname" AND "t"."DefeatedBySquadId" = "g"."SquadId" -LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" ORDER BY "f"."Id", "t"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -8271,7 +8235,7 @@ public override async Task Checked_context_with_addition_does_not_fail(bool asyn """ SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" FROM "LocustLeaders" AS "l" -WHERE CAST("l"."ThreatLevel" AS INTEGER) >= (5 + CAST("l"."ThreatLevel" AS INTEGER)) +WHERE CAST("l"."ThreatLevel" AS INTEGER) >= 5 + CAST("l"."ThreatLevel" AS INTEGER) """); } @@ -8372,7 +8336,7 @@ public override async Task Null_propagation_optimization1(bool async) """ SELECT "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank" FROM "Gears" AS "g" -WHERE "g"."LeaderNickname" = 'Marcus' AND ("g"."LeaderNickname" IS NOT NULL) +WHERE "g"."LeaderNickname" = 'Marcus' AND "g"."LeaderNickname" IS NOT NULL """); } @@ -8390,7 +8354,7 @@ LEFT JOIN ( WHERE "l"."Discriminator" = 'LocustCommander' ) AS "t" ON "f"."CommanderName" = "t"."Name" LEFT JOIN "Gears" AS "g" ON "t"."DefeatedByNickname" = "g"."Nickname" AND "t"."DefeatedBySquadId" = "g"."SquadId" -LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR (("g"."Nickname" IS NULL) AND ("g0"."LeaderNickname" IS NULL))) AND "g"."SquadId" = "g0"."LeaderSquadId" +LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" ORDER BY "f"."Id", "t"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -8486,7 +8450,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM "Weapons" AS "w" - WHERE "w"."Name" <> 'Bar' OR ("w"."Name" IS NULL) + WHERE "w"."Name" <> 'Bar' OR "w"."Name" IS NULL ) AS "t" ON "g0"."FullName" = "t"."OwnerFullName" WHERE "g0"."FullName" <> 'Foo' ) AS "t0" ON "g"."Nickname" = "t0"."LeaderNickname" AND "g"."SquadId" = "t0"."LeaderSquadId" @@ -8519,7 +8483,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN "Tags" AS "t0" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON "t0"."GearNickName" = "g0"."Nickname" AND "t0"."GearSquadId" = "g0"."SquadId" -WHERE "g"."Nickname" = "g0"."Nickname" OR (("g"."Nickname" IS NULL) AND ("g0"."Nickname" IS NULL)) +WHERE "g"."Nickname" = "g0"."Nickname" OR ("g"."Nickname" IS NULL AND "g0"."Nickname" IS NULL) """); } @@ -8629,7 +8593,7 @@ public override async Task Select_Where_Navigation_Equals_Navigation(bool async) CROSS JOIN "Tags" AS "t0" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON "t0"."GearNickName" = "g0"."Nickname" AND "t0"."GearSquadId" = "g0"."SquadId" -WHERE ("g"."Nickname" = "g0"."Nickname" OR (("g"."Nickname" IS NULL) AND ("g0"."Nickname" IS NULL))) AND ("g"."SquadId" = "g0"."SquadId" OR (("g"."SquadId" IS NULL) AND ("g0"."SquadId" IS NULL))) +WHERE ("g"."Nickname" = "g0"."Nickname" OR ("g"."Nickname" IS NULL AND "g0"."Nickname" IS NULL)) AND ("g"."SquadId" = "g0"."SquadId" OR ("g"."SquadId" IS NULL AND "g0"."SquadId" IS NULL)) """); } @@ -8668,7 +8632,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT "g"."SquadId" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL """); } @@ -8750,7 +8714,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list SELECT "g"."SquadId", "g"."SquadId" + 1 FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" -WHERE "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL ORDER BY "t"."Note" """); } @@ -8762,7 +8726,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( """ SELECT CASE - WHEN "t"."Note" <> 'K.I.A.' OR ("t"."Note" IS NULL) THEN CASE + WHEN "t"."Note" <> 'K.I.A.' OR "t"."Note" IS NULL THEN CASE WHEN "t"."GearNickName" IS NOT NULL THEN "g"."SquadId" ELSE NULL END @@ -8783,7 +8747,7 @@ SELECT NOT EXISTS ( SELECT 1 FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" - WHERE "t"."Note" = 'Foo' AND ("t"."Note" IS NOT NULL)) + WHERE "t"."Note" = 'Foo' AND "t"."Note" IS NOT NULL) """); } @@ -8796,7 +8760,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b SELECT COUNT(*) FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" -WHERE "t"."Note" <> 'Foo' OR ("t"."Note" IS NULL) +WHERE "t"."Note" <> 'Foo' OR "t"."Note" IS NULL """); } @@ -8847,9 +8811,9 @@ public override async Task Select_enum_has_flag(bool async) AssertSql( """ -SELECT ("g"."Rank" & 2) = 2 AS "hasFlagTrue", ("g"."Rank" & 4) = 4 AS "hasFlagFalse" +SELECT "g"."Rank" & 2 = 2 AS "hasFlagTrue", "g"."Rank" & 4 = 4 AS "hasFlagFalse" FROM "Gears" AS "g" -WHERE ("g"."Rank" & 2) = 2 +WHERE "g"."Rank" & 2 = 2 LIMIT 1 """); } @@ -9022,7 +8986,7 @@ public override async Task String_concat_on_various_types(bool async) AssertSql( """ -SELECT ('HasSoulPatch ' || CAST("g"."HasSoulPatch" AS TEXT)) || ' HasSoulPatch' AS "HasSoulPatch", ('Rank ' || CAST("g"."Rank" AS TEXT)) || ' Rank' AS "Rank", ('SquadId ' || CAST("g"."SquadId" AS TEXT)) || ' SquadId' AS "SquadId", ('Rating ' || COALESCE(CAST("m"."Rating" AS TEXT), '')) || ' Rating' AS "Rating", ('Timeline ' || CAST("m"."Timeline" AS TEXT)) || ' Timeline' AS "Timeline" +SELECT 'HasSoulPatch ' || CAST("g"."HasSoulPatch" AS TEXT) || ' HasSoulPatch' AS "HasSoulPatch", 'Rank ' || CAST("g"."Rank" AS TEXT) || ' Rank' AS "Rank", 'SquadId ' || CAST("g"."SquadId" AS TEXT) || ' SquadId' AS "SquadId", 'Rating ' || COALESCE(CAST("m"."Rating" AS TEXT), '') || ' Rating' AS "Rating", 'Timeline ' || CAST("m"."Timeline" AS TEXT) || ' Timeline' AS "Timeline" FROM "Gears" AS "g" CROSS JOIN "Missions" AS "m" ORDER BY "g"."Nickname", "m"."Id" @@ -9091,7 +9055,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( """ -SELECT "t0"."Name" = 'Queen Myrrah' AND ("t0"."Name" IS NOT NULL), "t0"."Name", "t0"."Discriminator", "t0"."LocustHordeId", "t0"."ThreatLevel", "t0"."ThreatLevelByte", "t0"."ThreatLevelNullableByte", "t0"."DefeatedByNickname", "t0"."DefeatedBySquadId", "t0"."HighCommandId", "t"."Name", "t"."Discriminator", "t"."LocustHordeId", "t"."ThreatLevel", "t"."ThreatLevelByte", "t"."ThreatLevelNullableByte", "t"."DefeatedByNickname", "t"."DefeatedBySquadId", "t"."HighCommandId" +SELECT "t0"."Name" = 'Queen Myrrah' AND "t0"."Name" IS NOT NULL, "t0"."Name", "t0"."Discriminator", "t0"."LocustHordeId", "t0"."ThreatLevel", "t0"."ThreatLevelByte", "t0"."ThreatLevelNullableByte", "t0"."DefeatedByNickname", "t0"."DefeatedBySquadId", "t0"."HighCommandId", "t"."Name", "t"."Discriminator", "t"."LocustHordeId", "t"."ThreatLevel", "t"."ThreatLevelByte", "t"."ThreatLevelNullableByte", "t"."DefeatedByNickname", "t"."DefeatedBySquadId", "t"."HighCommandId" FROM "Factions" AS "f" CROSS JOIN ( SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId" diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs index 3c248bd668e..75b71e662be 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs @@ -197,7 +197,7 @@ public override async Task String_StartsWith_Literal(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."ContactName" IS NOT NULL) AND ("c"."ContactName" LIKE 'M%') +WHERE "c"."ContactName" IS NOT NULL AND "c"."ContactName" LIKE 'M%' """); } @@ -209,7 +209,7 @@ public override async Task String_StartsWith_Identity(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE "c"."ContactName" = '' OR (("c"."ContactName" IS NOT NULL) AND ((("c"."ContactName" LIKE "c"."ContactName" || '%') AND substr("c"."ContactName", 1, length("c"."ContactName")) = "c"."ContactName") OR "c"."ContactName" = '')) +WHERE "c"."ContactName" = '' OR ("c"."ContactName" IS NOT NULL AND (("c"."ContactName" LIKE "c"."ContactName" || '%' AND substr("c"."ContactName", 1, length("c"."ContactName")) = "c"."ContactName") OR "c"."ContactName" = '')) """); } @@ -221,7 +221,7 @@ public override async Task String_StartsWith_Column(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE "c"."ContactName" = '' OR (("c"."ContactName" IS NOT NULL) AND ((("c"."ContactName" LIKE "c"."ContactName" || '%') AND substr("c"."ContactName", 1, length("c"."ContactName")) = "c"."ContactName") OR "c"."ContactName" = '')) +WHERE "c"."ContactName" = '' OR ("c"."ContactName" IS NOT NULL AND (("c"."ContactName" LIKE "c"."ContactName" || '%' AND substr("c"."ContactName", 1, length("c"."ContactName")) = "c"."ContactName") OR "c"."ContactName" = '')) """); } @@ -233,7 +233,7 @@ public override async Task String_StartsWith_MethodCall(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."ContactName" IS NOT NULL) AND ("c"."ContactName" LIKE 'M%') +WHERE "c"."ContactName" IS NOT NULL AND "c"."ContactName" LIKE 'M%' """); } @@ -245,7 +245,7 @@ public override async Task String_EndsWith_Literal(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."ContactName" IS NOT NULL) AND ("c"."ContactName" LIKE '%b') +WHERE "c"."ContactName" IS NOT NULL AND "c"."ContactName" LIKE '%b' """); } @@ -257,7 +257,7 @@ public override async Task String_EndsWith_Identity(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE "c"."ContactName" = '' OR (("c"."ContactName" IS NOT NULL) AND (substr("c"."ContactName", -length("c"."ContactName")) = "c"."ContactName" OR "c"."ContactName" = '')) +WHERE "c"."ContactName" = '' OR ("c"."ContactName" IS NOT NULL AND (substr("c"."ContactName", -length("c"."ContactName")) = "c"."ContactName" OR "c"."ContactName" = '')) """); } @@ -269,7 +269,7 @@ public override async Task String_EndsWith_Column(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE "c"."ContactName" = '' OR (("c"."ContactName" IS NOT NULL) AND (substr("c"."ContactName", -length("c"."ContactName")) = "c"."ContactName" OR "c"."ContactName" = '')) +WHERE "c"."ContactName" = '' OR ("c"."ContactName" IS NOT NULL AND (substr("c"."ContactName", -length("c"."ContactName")) = "c"."ContactName" OR "c"."ContactName" = '')) """); } @@ -281,7 +281,7 @@ public override async Task String_EndsWith_MethodCall(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."ContactName" IS NOT NULL) AND ("c"."ContactName" LIKE '%m') +WHERE "c"."ContactName" IS NOT NULL AND "c"."ContactName" LIKE '%m' """); } @@ -431,7 +431,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."Region" IS NULL) OR trim("c"."Region") = '' +WHERE "c"."Region" IS NULL OR trim("c"."Region") = '' """); } @@ -443,7 +443,7 @@ public override async Task Indexof_with_emptystring(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE (instr("c"."ContactName", '') - 1) = 0 +WHERE instr("c"."ContactName", '') - 1 = 0 """); } @@ -455,7 +455,7 @@ public override async Task Indexof_with_one_constant_arg(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE (instr("c"."ContactName", 'a') - 1) = 1 +WHERE instr("c"."ContactName", 'a') - 1 = 1 """); } @@ -469,7 +469,7 @@ public override async Task Indexof_with_one_parameter_arg(bool async) SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE (instr("c"."ContactName", @__pattern_0) - 1) = 1 +WHERE instr("c"."ContactName", @__pattern_0) - 1 = 1 """); } @@ -856,7 +856,7 @@ public override async Task IsNullOrEmpty_in_predicate(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."Region" IS NULL) OR "c"."Region" = '' +WHERE "c"."Region" IS NULL OR "c"."Region" = '' """); } @@ -866,7 +866,7 @@ public override async Task IsNullOrEmpty_in_projection(bool async) AssertSql( """ -SELECT "c"."CustomerID" AS "Id", ("c"."Region" IS NULL) OR "c"."Region" = '' AS "Value" +SELECT "c"."CustomerID" AS "Id", "c"."Region" IS NULL OR "c"."Region" = '' AS "Value" FROM "Customers" AS "c" """); } @@ -879,7 +879,7 @@ public override async Task IsNullOrEmpty_negated_in_predicate(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE ("c"."Region" IS NOT NULL) AND "c"."Region" <> '' +WHERE "c"."Region" IS NOT NULL AND "c"."Region" <> '' """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs index 9e021845dfe..8498b848150 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs @@ -28,7 +28,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy """ SELECT "o"."CustomerID" FROM "Orders" AS "o" -WHERE ("o"."OrderDate" IS NOT NULL) AND ('10' = '' OR instr(CAST("o"."EmployeeID" AS TEXT), '10') > 0) +WHERE "o"."OrderDate" IS NOT NULL AND ('10' = '' OR instr(CAST("o"."EmployeeID" AS TEXT), '10') > 0) """); } @@ -176,7 +176,7 @@ await AssertQuery( AssertSql( """ -SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST((100000000 / 10000000) AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" +SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST(100000000 / 10000000 AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" FROM "Orders" AS "o" WHERE "o"."OrderDate" IS NOT NULL """); @@ -188,7 +188,7 @@ public override async Task Select_expression_date_add_milliseconds_above_the_ran AssertSql( """ -SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST((1000000000000.0 / 1000.0) AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" +SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST(1000000000000.0 / 1000.0 AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" FROM "Orders" AS "o" WHERE "o"."OrderDate" IS NOT NULL """); @@ -200,7 +200,7 @@ public override async Task Select_expression_date_add_milliseconds_below_the_ran AssertSql( """ -SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST((-1000000000000.0 / 1000.0) AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" +SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", CAST(-1000000000000.0 / 1000.0 AS TEXT) || ' seconds'), '0'), '.') AS "OrderDate" FROM "Orders" AS "o" WHERE "o"."OrderDate" IS NOT NULL """); @@ -214,7 +214,7 @@ public override async Task Select_expression_date_add_milliseconds_large_number_ """ @__millisecondsPerDay_0='86400000' -SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", COALESCE(CAST(CAST((CAST(((CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0) AS INTEGER) / @__millisecondsPerDay_0) AS REAL) AS TEXT), '') || ' days', COALESCE(CAST((CAST((CAST(((CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0) AS INTEGER) % @__millisecondsPerDay_0) AS REAL) / 1000.0) AS TEXT), '') || ' seconds'), '0'), '.') AS "OrderDate" +SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', "o"."OrderDate", COALESCE(CAST(CAST(CAST((CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0 AS INTEGER) / @__millisecondsPerDay_0 AS REAL) AS TEXT), '') || ' days', COALESCE(CAST(CAST(CAST((CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0 AS INTEGER) % @__millisecondsPerDay_0 AS REAL) / 1000.0 AS TEXT), '') || ' seconds'), '0'), '.') AS "OrderDate" FROM "Orders" AS "o" WHERE "o"."OrderDate" IS NOT NULL """); @@ -226,7 +226,7 @@ public override async Task Add_minutes_on_constant_value(bool async) AssertSql( """ -SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', '1900-01-01 00:00:00', CAST(CAST(("o"."OrderID" % 25) AS REAL) AS TEXT) || ' minutes'), '0'), '.') AS "Test" +SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', '1900-01-01 00:00:00', CAST(CAST("o"."OrderID" % 25 AS REAL) AS TEXT) || ' minutes'), '0'), '.') AS "Test" FROM "Orders" AS "o" WHERE "o"."OrderID" < 10500 ORDER BY "o"."OrderID" diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs index 8a7387bd543..0e77b2c373b 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs @@ -25,7 +25,7 @@ public override async Task Count_query(bool async) SELECT COUNT(*) FROM "Customers" AS "c" -WHERE @__ef_filter__TenantPrefix_0 = '' OR (("c"."CompanyName" LIKE @__ef_filter__TenantPrefix_0 || '%') AND substr("c"."CompanyName", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) OR @__ef_filter__TenantPrefix_0 = '' +WHERE @__ef_filter__TenantPrefix_0 = '' OR ("c"."CompanyName" LIKE @__ef_filter__TenantPrefix_0 || '%' AND substr("c"."CompanyName", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) OR @__ef_filter__TenantPrefix_0 = '' """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindSelectQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindSelectQuerySqliteTest.cs index 7616cdcbc6b..ac5a3cc7a2f 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindSelectQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindSelectQuerySqliteTest.cs @@ -135,7 +135,7 @@ public override async Task Select_datetime_Ticks_component(bool async) AssertSql( """ -SELECT CAST(((julianday("o"."OrderDate") - 1721425.5) * 864000000000.0) AS INTEGER) +SELECT CAST((julianday("o"."OrderDate") - 1721425.5) * 864000000000.0 AS INTEGER) FROM "Orders" AS "o" """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs index 76e29c20357..087c7212cde 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs @@ -190,7 +190,7 @@ public override async Task Where_datetime_millisecond_component(bool async) """ SELECT "o"."OrderID", "o"."CustomerID", "o"."EmployeeID", "o"."OrderDate" FROM "Orders" AS "o" -WHERE ((CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0) = 88.0 +WHERE (CAST(strftime('%f', "o"."OrderDate") AS REAL) * 1000.0) % 1000.0 = 88.0 """); } @@ -214,7 +214,7 @@ public override async Task Where_string_indexof(bool async) """ SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region" FROM "Customers" AS "c" -WHERE (instr("c"."City", 'Sea') - 1) <> -1 OR ("c"."City" IS NULL) +WHERE instr("c"."City", 'Sea') - 1 <> -1 OR "c"."City" IS NULL """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/OperatorsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/OperatorsQuerySqliteTest.cs index 4bb53fc524a..40752dbd37e 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/OperatorsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/OperatorsQuerySqliteTest.cs @@ -44,6 +44,62 @@ public override async Task Projection_with_not_and_negation_on_integer() { await base.Projection_with_not_and_negation_on_integer(); - AssertSql(""); + AssertSql( +""" +SELECT ~(-(-("o1"."Value" + "o"."Value" + 2))) % (-("o0"."Value" + "o0"."Value") - "o"."Value") +FROM "OperatorEntityLong" AS "o" +CROSS JOIN "OperatorEntityLong" AS "o0" +CROSS JOIN "OperatorEntityLong" AS "o1" +ORDER BY "o"."Id", "o0"."Id", "o1"."Id" +"""); + } + + public override async Task Negate_on_column(bool async) + { + await base.Negate_on_column(async); + + AssertSql( +""" +SELECT "o"."Id" +FROM "OperatorEntityInt" AS "o" +WHERE "o"."Id" = -"o"."Value" +"""); + } + + public override async Task Double_negate_on_column() + { + await base.Double_negate_on_column(); + + AssertSql( +""" +SELECT "o"."Id" +FROM "OperatorEntityInt" AS "o" +WHERE -(-"o"."Value") = "o"."Value" +"""); + } + + public override async Task Negate_on_binary_expression(bool async) + { + await base.Negate_on_binary_expression(async); + + AssertSql( +""" +SELECT "o"."Id" AS "Id1", "o0"."Id" AS "Id2" +FROM "OperatorEntityInt" AS "o" +CROSS JOIN "OperatorEntityInt" AS "o0" +WHERE -"o"."Value" = -("o"."Id" + "o0"."Value") +"""); + } + + public override async Task Negate_on_like_expression(bool async) + { + await base.Negate_on_like_expression(async); + + AssertSql( +""" +SELECT "o"."Id" +FROM "OperatorEntityString" AS "o" +WHERE "o"."Value" IS NOT NULL AND NOT ("o"."Value" LIKE 'A%') +"""); } } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs index af9fc4e0122..d87bd6753b2 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs @@ -208,42 +208,6 @@ public override async Task .Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( async))).Message); - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -("s"."Id" + "s"."Id") -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -"s"."Id" -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE ("s"."Name" IS NOT NULL) AND NOT ("s"."Name" LIKE 'us%') -"""); - } - public override async Task Select_datetimeoffset_comparison_in_projection(bool async) { await base.Select_datetimeoffset_comparison_in_projection(async); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs index 4727d9b01ec..240c197f9bb 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs @@ -208,42 +208,6 @@ public override async Task .Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( async))).Message); - public override async Task Negate_on_binary_expression(bool async) - { - await base.Negate_on_binary_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -("s"."Id" + "s"."Id") -"""); - } - - public override async Task Negate_on_column(bool async) - { - await base.Negate_on_column(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE "s"."Id" = -"s"."Id" -"""); - } - - public override async Task Negate_on_like_expression(bool async) - { - await base.Negate_on_like_expression(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE ("s"."Name" IS NOT NULL) AND NOT ("s"."Name" LIKE 'us%') -"""); - } - public override async Task Select_datetimeoffset_comparison_in_projection(bool async) { await base.Select_datetimeoffset_comparison_in_projection(async);