diff --git a/.gitignore b/.gitignore index f3139fa65a..dbb844096e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.DS_Store +0.DS_Store *.resources *.suo *.user @@ -16,3 +16,4 @@ artifacts/ *.ide/ TestResult.xml .dotnet +.vscode/ diff --git a/Directory.Packages.props b/Directory.Packages.props index eee3c67103..e57544cca4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,7 +1,7 @@ - 10.0.0-preview.7.25380.108 - 10.0.0-preview.7.25380.108 + 10.0.0-rc.1.25416.111 + 10.0.0-rc.1.25416.111 9.0.3 diff --git a/global.json b/global.json index bab9253442..5cb25519f8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.100-preview.5.25277.114", + "version": "10.0.100-preview.7.25380.108", "rollForward": "latestMajor", "allowPrerelease": true } diff --git a/src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessor.cs b/src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessor.cs index 6def82e2c9..8405e12fde 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessor.cs @@ -27,9 +27,9 @@ public NpgsqlParameterBasedSqlProcessor( /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public override Expression Process(Expression queryExpression, CacheSafeParameterFacade parametersFacade) + public override Expression Process(Expression queryExpression, ParametersCacheDecorator parametersDecorator) { - queryExpression = base.Process(queryExpression, parametersFacade); + queryExpression = base.Process(queryExpression, parametersDecorator); queryExpression = new NpgsqlDeleteConvertingExpressionVisitor().Process(queryExpression); @@ -37,6 +37,6 @@ public override Expression Process(Expression queryExpression, CacheSafeParamete } /// - protected override Expression ProcessSqlNullability(Expression selectExpression, CacheSafeParameterFacade parametersFacade) - => new NpgsqlSqlNullabilityProcessor(Dependencies, Parameters).Process(selectExpression, parametersFacade); + protected override Expression ProcessSqlNullability(Expression selectExpression, ParametersCacheDecorator parametersDecorator) + => new NpgsqlSqlNullabilityProcessor(Dependencies, Parameters).Process(selectExpression, parametersDecorator); } diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs index 5de8f23be2..4a7fed3922 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs @@ -1069,7 +1069,7 @@ protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExp { // This case is for when a nested JSON entity is being accessed. We want the json/jsonb fragment in this case (not text), // so we can perform further JSON operations on it. - case NpgsqlOwnedJsonTypeMapping: + case NpgsqlStructuralJsonTypeMapping: GenerateJsonPath(returnsText: false); break; diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs index 4660c863ee..b8d9fc2a62 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs @@ -199,14 +199,14 @@ protected override ShapedQueryExpression TransformJsonQueryToTable(JsonQueryExpr }; var jsonTypeMapping = jsonQueryExpression.JsonColumn.TypeMapping!; - Check.DebugAssert(jsonTypeMapping is NpgsqlOwnedJsonTypeMapping, "JSON column has a non-JSON mapping"); + Check.DebugAssert(jsonTypeMapping is NpgsqlStructuralJsonTypeMapping, "JSON column has a non-JSON mapping"); // We now add all of projected entity's the properties and navigations into the jsonb_to_recordset's AS clause, which defines the // names and types of columns to come out of the JSON fragments. var columnInfos = new List(); // We're only interested in properties which actually exist in the JSON, filter out uninteresting shadow keys - foreach (var property in GetAllPropertiesInHierarchy(jsonQueryExpression.EntityType)) + foreach (var property in jsonQueryExpression.StructuralType.GetPropertiesInHierarchy()) { if (property.GetJsonPropertyName() is string jsonPropertyName) { @@ -218,18 +218,37 @@ protected override ShapedQueryExpression TransformJsonQueryToTable(JsonQueryExpr } } - // Navigations represent nested JSON owned entities, which we also add to the AS clause, but with the JSON type. - foreach (var navigation in GetAllNavigationsInHierarchy(jsonQueryExpression.EntityType) - .Where( - n => n.ForeignKey.IsOwnership - && n.TargetEntityType.IsMappedToJson() - && n.ForeignKey.PrincipalToDependent == n)) + switch (jsonQueryExpression.StructuralType) { - var jsonNavigationName = navigation.TargetEntityType.GetJsonPropertyName(); - Check.DebugAssert(jsonNavigationName is not null, $"No JSON property name for navigation {navigation.Name}"); + case IEntityType entityType: + foreach (var navigation in entityType.GetNavigationsInHierarchy() + .Where(n => n.ForeignKey.IsOwnership + && n.TargetEntityType.IsMappedToJson() + && n.ForeignKey.PrincipalToDependent == n)) + { + var jsonNavigationName = navigation.TargetEntityType.GetJsonPropertyName(); + Check.DebugAssert(jsonNavigationName is not null, $"No JSON property name for navigation {navigation.Name}"); + + columnInfos.Add( + new PgTableValuedFunctionExpression.ColumnInfo { Name = jsonNavigationName, TypeMapping = jsonTypeMapping }); + } + + break; + + case IComplexType complexType: + foreach (var complexProperty in complexType.GetComplexProperties()) + { + var jsonPropertyName = complexProperty.ComplexType.GetJsonPropertyName(); + Check.DebugAssert(jsonPropertyName is not null, $"No JSON property name for complex property {complexProperty.Name}"); - columnInfos.Add( - new PgTableValuedFunctionExpression.ColumnInfo { Name = jsonNavigationName, TypeMapping = jsonTypeMapping }); + columnInfos.Add( + new PgTableValuedFunctionExpression.ColumnInfo { Name = jsonPropertyName, TypeMapping = jsonTypeMapping }); + } + + break; + + default: + throw new UnreachableException(); } // json_to_recordset requires the nested JSON document - it does not accept a path within a containing JSON document (like SQL @@ -254,21 +273,12 @@ protected override ShapedQueryExpression TransformJsonQueryToTable(JsonQueryExpr return new ShapedQueryExpression( selectExpression, new RelationalStructuralTypeShaperExpression( - jsonQueryExpression.EntityType, + jsonQueryExpression.StructuralType, new ProjectionBindingExpression( selectExpression, new ProjectionMember(), typeof(ValueBuffer)), false)); - - // TODO: Move these to IEntityType? - static IEnumerable GetAllPropertiesInHierarchy(IEntityType entityType) - => entityType.GetAllBaseTypes().Concat(entityType.GetDerivedTypesInclusive()) - .SelectMany(t => t.GetDeclaredProperties()); - - static IEnumerable GetAllNavigationsInHierarchy(IEntityType entityType) - => entityType.GetAllBaseTypes().Concat(entityType.GetDerivedTypesInclusive()) - .SelectMany(t => t.GetDeclaredNavigations()); } /// diff --git a/src/EFCore.PG/Query/Internal/NpgsqlSqlNullabilityProcessor.cs b/src/EFCore.PG/Query/Internal/NpgsqlSqlNullabilityProcessor.cs index e5ce083dab..736c47e8b1 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlSqlNullabilityProcessor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlSqlNullabilityProcessor.cs @@ -737,5 +737,5 @@ private static bool MayContainNulls(SqlExpression arrayExpression) // Note that we can check parameter values for null since we cache by the parameter nullability; but we cannot do the same for bool. private bool IsNull(SqlExpression? expression) => expression is SqlConstantExpression { Value: null } - || expression is SqlParameterExpression { Name: string parameterName } && ParametersFacade.IsParameterNull(parameterName); + || expression is SqlParameterExpression { Name: string parameterName } && ParametersDecorator.IsNull(parameterName); } diff --git a/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs b/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs index 082bd59b5c..fbfdfbe781 100644 --- a/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs @@ -300,16 +300,40 @@ when binaryExpression.Left.Type.UnwrapNullableType().FullName == "NodaTime.Local // further JSON operations may need to be composed. However, when the value extracted is a JSON null, a non-NULL jsonb value is // returned, and comparing that to relational NULL returns false. // Pattern-match this and force the use of ->> by changing the mapping to be a scalar rather than an entity type. - case SqlUnaryExpression + case SqlBinaryExpression { OperatorType: ExpressionType.Equal or ExpressionType.NotEqual, - Operand: JsonScalarExpression { TypeMapping: NpgsqlOwnedJsonTypeMapping } operand - } unary: + Left: JsonScalarExpression { TypeMapping: NpgsqlStructuralJsonTypeMapping } operand, + Right: SqlConstantExpression { Value: null } + } binary: { - return unary.Update( + return binary.Update( + new JsonScalarExpression( + operand.Json, operand.Path, operand.Type, _typeMappingSource.FindMapping("text"), operand.IsNullable), + binary.Right); + } + case SqlBinaryExpression + { + OperatorType: ExpressionType.Equal or ExpressionType.NotEqual, + Left: SqlConstantExpression { Value: null }, + Right: JsonScalarExpression { TypeMapping: NpgsqlStructuralJsonTypeMapping } operand + } binary: + { + return binary.Update( + binary.Left, new JsonScalarExpression( operand.Json, operand.Path, operand.Type, _typeMappingSource.FindMapping("text"), operand.IsNullable)); } + // Unfortunately EF isn't consistent in its representation of X IS NULL in the SQL tree - sometimes it's a SqlUnaryExpression with Equals, + // sometimes it's an X = NULL SqlBinaryExpression that later gets transformed to SqlUnaryExpression, in SqlNullabilityProcessor. We recognize + // both of these here. + case SqlUnaryExpression + { + Operand: JsonScalarExpression { TypeMapping: NpgsqlStructuralJsonTypeMapping } operand + } unary: + return unary.Update( + new JsonScalarExpression( + operand.Json, operand.Path, operand.Type, _typeMappingSource.FindMapping("text"), operand.IsNullable)); } return translation; diff --git a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs index e0931b1986..17eda324d4 100644 --- a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs +++ b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlJsonTypeMapping.cs @@ -6,7 +6,7 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping; /// /// Supports the older Npgsql-specific JSON mapping, allowing mapping json/jsonb to text, to e.g. /// (weakly-typed mapping) or to arbitrary POCOs (but without them being modeled). -/// For the standard EF JSON support, which relies on owned entity modeling, see . +/// For the standard EF JSON support, which relies on owned entity modeling, see . /// public class NpgsqlJsonTypeMapping : NpgsqlTypeMapping { diff --git a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlOwnedJsonTypeMapping.cs b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlStructuralJsonTypeMapping.cs similarity index 91% rename from src/EFCore.PG/Storage/Internal/Mapping/NpgsqlOwnedJsonTypeMapping.cs rename to src/EFCore.PG/Storage/Internal/Mapping/NpgsqlStructuralJsonTypeMapping.cs index 0be732a0db..8fe503f11f 100644 --- a/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlOwnedJsonTypeMapping.cs +++ b/src/EFCore.PG/Storage/Internal/Mapping/NpgsqlStructuralJsonTypeMapping.cs @@ -5,11 +5,11 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping; /// -/// Supports the standard EF JSON support, which relies on owned entity modeling. +/// Supports the standard EF JSON support, which relies on owned entity or complex type modeling. /// See for the older Npgsql-specific support, which allows mapping json/jsonb to text, to e.g. /// (weakly-typed mapping) or to arbitrary POCOs (but without them being modeled). /// -public class NpgsqlOwnedJsonTypeMapping : JsonTypeMapping +public class NpgsqlStructuralJsonTypeMapping : JsonTypeMapping { /// /// The database type used by Npgsql ( or . @@ -34,7 +34,7 @@ private static readonly ConstructorInfo MemoryStreamConstructor /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public NpgsqlOwnedJsonTypeMapping(string storeType) + public NpgsqlStructuralJsonTypeMapping(string storeType) : base(storeType, typeof(JsonElement), dbType: null) { NpgsqlDbType = storeType switch @@ -74,7 +74,7 @@ public override Expression CustomizeDataReaderExpression(Expression expression) /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - protected NpgsqlOwnedJsonTypeMapping(RelationalTypeMappingParameters parameters, NpgsqlDbType npgsqlDbType) + protected NpgsqlStructuralJsonTypeMapping(RelationalTypeMappingParameters parameters, NpgsqlDbType npgsqlDbType) : base(parameters) { NpgsqlDbType = npgsqlDbType; @@ -91,7 +91,7 @@ protected override void ConfigureParameter(DbParameter parameter) if (parameter is not NpgsqlParameter npgsqlParameter) { throw new InvalidOperationException( - $"Npgsql-specific type mapping {nameof(NpgsqlOwnedJsonTypeMapping)} being used with non-Npgsql parameter type {parameter.GetType().Name}"); + $"Npgsql-specific type mapping {nameof(NpgsqlStructuralJsonTypeMapping)} being used with non-Npgsql parameter type {parameter.GetType().Name}"); } base.ConfigureParameter(parameter); @@ -114,7 +114,7 @@ protected virtual string EscapeSqlLiteral(string literal) /// doing so can result in application failures when updating to a new Entity Framework Core release. /// protected override string GenerateNonNullSqlLiteral(object value) - => $"'{EscapeSqlLiteral(JsonSerializer.Serialize(value))}'"; + => $"'{EscapeSqlLiteral((string)value)}'"; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -123,5 +123,5 @@ protected override string GenerateNonNullSqlLiteral(object value) /// doing so can result in application failures when updating to a new Entity Framework Core release. /// protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) - => new NpgsqlOwnedJsonTypeMapping(parameters, NpgsqlDbType); + => new NpgsqlStructuralJsonTypeMapping(parameters, NpgsqlDbType); } diff --git a/src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs b/src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs index 30328fe9c3..7e457ec59d 100644 --- a/src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs +++ b/src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs @@ -88,8 +88,8 @@ static NpgsqlTypeMappingSource() private readonly NpgsqlStringTypeMapping _jsonpath = new("jsonpath", NpgsqlDbType.JsonPath); // JSON mappings - EF owned entity support - private readonly NpgsqlOwnedJsonTypeMapping _jsonbOwned = new("jsonb"); - private readonly NpgsqlOwnedJsonTypeMapping _jsonOwned = new("json"); + private readonly NpgsqlStructuralJsonTypeMapping _jsonbOwned = new("jsonb"); + private readonly NpgsqlStructuralJsonTypeMapping _jsonOwned = new("json"); // JSON mappings - older string/weakly-typed support private readonly NpgsqlJsonTypeMapping _jsonbString = new("jsonb", typeof(string)); diff --git a/src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.cs b/src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.cs index fa7d1fad05..cecf95aee3 100644 --- a/src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.cs +++ b/src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.cs @@ -130,7 +130,7 @@ protected override void AppendUpdateColumnValue( if (columnModification.JsonPath is not (null or "$")) { Check.DebugAssert( - columnModification.TypeMapping is NpgsqlOwnedJsonTypeMapping, + columnModification.TypeMapping is NpgsqlStructuralJsonTypeMapping, "ColumnModification with JsonPath but non-NpgsqlOwnedJsonTypeMapping"); if (columnModification.TypeMapping.StoreType is "json") diff --git a/test/EFCore.PG.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesNpgsqlTest.cs index 006b27647e..8cca5da20a 100644 --- a/test/EFCore.PG.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesNpgsqlTest.cs @@ -232,6 +232,54 @@ public override async Task Update_collection_inside_complex_type(bool async) """); } + public override async Task Update_complex_type_to_null(bool async) + { + await base.Update_complex_type_to_null(async); + + AssertExecuteUpdateSql( + """ +UPDATE "Customer" AS c +SET "OptionalAddress_AddressLine1" = NULL, + "OptionalAddress_AddressLine2" = NULL, + "OptionalAddress_Tags" = NULL, + "OptionalAddress_ZipCode" = NULL, + "OptionalAddress_Country_Code" = NULL, + "OptionalAddress_Country_FullName" = NULL +"""); + } + + public override async Task Update_complex_type_to_null_lambda(bool async) + { + await base.Update_complex_type_to_null_lambda(async); + + AssertExecuteUpdateSql( + """ +UPDATE "Customer" AS c +SET "OptionalAddress_AddressLine1" = NULL, + "OptionalAddress_AddressLine2" = NULL, + "OptionalAddress_Tags" = NULL, + "OptionalAddress_ZipCode" = NULL, + "OptionalAddress_Country_Code" = NULL, + "OptionalAddress_Country_FullName" = NULL +"""); + } + + public override async Task Update_complex_type_to_null_parameter(bool async) + { + await base.Update_complex_type_to_null_parameter(async); + + AssertExecuteUpdateSql( + """ +UPDATE "Customer" AS c +SET "OptionalAddress_AddressLine1" = NULL, + "OptionalAddress_AddressLine2" = NULL, + "OptionalAddress_Tags" = NULL, + "OptionalAddress_ZipCode" = NULL, + "OptionalAddress_Country_Code" = NULL, + "OptionalAddress_Country_FullName" = NULL +"""); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.PG.FunctionalTests/ComplexTypesTrackingNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/ComplexTypesTrackingNpgsqlTest.cs index 8a5c929dc6..02e81489b5 100644 --- a/test/EFCore.PG.FunctionalTests/ComplexTypesTrackingNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/ComplexTypesTrackingNpgsqlTest.cs @@ -1,23 +1,18 @@ namespace Microsoft.EntityFrameworkCore; -public class ComplexTypesTrackingNpgsqlTest : ComplexTypesTrackingTestBase +public class ComplexTypesTrackingNpgsqlTest(ComplexTypesTrackingNpgsqlTest.NpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexTypesTrackingRelationalTestBase(fixture, testOutputHelper) { - public ComplexTypesTrackingNpgsqlTest(NpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - fixture.TestSqlLoggerFactory.Clear(); - fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } - protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction) => facade.UseTransaction(transaction.GetDbTransaction()); - public class NpgsqlFixture : FixtureBase + // 'timestamp with time zone' literal cannot be generated for Unspecified DateTime: a UTC DateTime is required + public override Task Can_track_entity_with_complex_property_bag_collections(EntityState state, bool async) + => Task.CompletedTask; + + public class NpgsqlFixture : RelationalFixtureBase { protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; } } diff --git a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs index 0783272fcb..137d43ab8f 100644 --- a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs @@ -3125,6 +3125,9 @@ public override async Task Create_table_with_complex_type_with_required_properti "MyComplex_Prop" text, "MyComplex_MyNestedComplex_Bar" timestamp with time zone, "MyComplex_MyNestedComplex_Foo" integer, + "MyComplex_Nested_Bar" timestamp with time zone, + "MyComplex_Nested_Foo" integer, + "NestedCollection" jsonb, CONSTRAINT "PK_Contacts" PRIMARY KEY ("Id") ); """); diff --git a/test/EFCore.PG.FunctionalTests/NpgsqlComplianceTest.cs b/test/EFCore.PG.FunctionalTests/NpgsqlComplianceTest.cs index bcf21d7403..2818565ce3 100644 --- a/test/EFCore.PG.FunctionalTests/NpgsqlComplianceTest.cs +++ b/test/EFCore.PG.FunctionalTests/NpgsqlComplianceTest.cs @@ -1,11 +1,20 @@ -namespace Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; +using Microsoft.EntityFrameworkCore.Query.Relationships.OwnedTableSplitting; + +namespace Microsoft.EntityFrameworkCore; public class NpgsqlComplianceTest : RelationalComplianceTestBase { protected override ICollection IgnoredTestBases { get; } = new HashSet { - // TODO: Enable for rc.1 (query support for complex collections mapped to JSON) - typeof(ComplexCollectionJsonUpdateTestBase<>), + // Temporary, remove for 10.0.0-rc.2 + typeof(OwnedTableSplittingMiscellaneousRelationalTestBase<>), + typeof(OwnedTableSplittingProjectionRelationalTestBase<>), + typeof(OwnedNavigationsCollectionRelationalTestBase<>), + typeof(OwnedNavigationsMiscellaneousRelationalTestBase<>), + typeof(OwnedNavigationsProjectionRelationalTestBase<>), + typeof(OwnedNavigationsStructuralEqualityRelationalTestBase<>), + typeof(OwnedTableSplittingStructuralEqualityRelationalTestBase<>), // Not implemented typeof(CompiledModelTestBase), typeof(CompiledModelRelationalTestBase), // #3087 diff --git a/test/EFCore.PG.FunctionalTests/PropertyValuesNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/PropertyValuesNpgsqlTest.cs index 1088fba2b6..cdbf39685d 100644 --- a/test/EFCore.PG.FunctionalTests/PropertyValuesNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/PropertyValuesNpgsqlTest.cs @@ -1,9 +1,9 @@ namespace Microsoft.EntityFrameworkCore; public class PropertyValuesNpgsqlTest(PropertyValuesNpgsqlTest.PropertyValuesNpgsqlFixture fixture) - : PropertyValuesTestBase(fixture) + : PropertyValuesRelationalTestBase(fixture) { - public class PropertyValuesNpgsqlFixture : PropertyValuesFixtureBase + public class PropertyValuesNpgsqlFixture : PropertyValuesRelationalFixture { protected override string StoreName { get; } = "PropertyValues"; diff --git a/test/EFCore.PG.FunctionalTests/Query/ComplexTypeQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/ComplexTypeQueryNpgsqlTest.cs index d13aa37b07..96ba32fe2f 100644 --- a/test/EFCore.PG.FunctionalTests/Query/ComplexTypeQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/ComplexTypeQueryNpgsqlTest.cs @@ -10,30 +10,6 @@ public ComplexTypeQueryNpgsqlTest(ComplexTypeQueryNpgsqlFixture fixture, ITestOu Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Filter_on_property_inside_complex_type(bool async) - { - await base.Filter_on_property_inside_complex_type(async); - - AssertSql( - """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" -FROM "Customer" AS c -WHERE c."ShippingAddress_ZipCode" = 7728 -"""); - } - - public override async Task Filter_on_property_inside_nested_complex_type(bool async) - { - await base.Filter_on_property_inside_nested_complex_type(async); - - AssertSql( - """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" -FROM "Customer" AS c -WHERE c."ShippingAddress_Country_Code" = 'DE' -"""); - } - public override async Task Filter_on_property_inside_complex_type_after_subquery(bool async) { await base.Filter_on_property_inside_complex_type_after_subquery(async); @@ -42,9 +18,9 @@ public override async Task Filter_on_property_inside_complex_type_after_subquery """ @p='1' -SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c ORDER BY c."Id" NULLS FIRST OFFSET @p @@ -61,9 +37,9 @@ public override async Task Filter_on_property_inside_nested_complex_type_after_s """ @p='1' -SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c ORDER BY c."Id" NULLS FIRST OFFSET @p @@ -78,7 +54,7 @@ public override async Task Filter_on_required_property_inside_required_complex_t AssertSql( """ -SELECT c."Id", c."OptionalCustomerId", c."RequiredCustomerId", c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName" +SELECT c."Id", c."OptionalCustomerId", c."RequiredCustomerId", c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."OptionalAddress_AddressLine1", c1."OptionalAddress_AddressLine2", c1."OptionalAddress_Tags", c1."OptionalAddress_ZipCode", c1."OptionalAddress_Country_Code", c1."OptionalAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName" FROM "CustomerGroup" AS c LEFT JOIN "Customer" AS c0 ON c."OptionalCustomerId" = c0."Id" INNER JOIN "Customer" AS c1 ON c."RequiredCustomerId" = c1."Id" @@ -92,7 +68,7 @@ public override async Task Filter_on_required_property_inside_required_complex_t AssertSql( """ -SELECT c."Id", c."OptionalCustomerId", c."RequiredCustomerId", c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT c."Id", c."OptionalCustomerId", c."RequiredCustomerId", c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."OptionalAddress_AddressLine1", c1."OptionalAddress_AddressLine2", c1."OptionalAddress_Tags", c1."OptionalAddress_ZipCode", c1."OptionalAddress_Country_Code", c1."OptionalAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM "CustomerGroup" AS c INNER JOIN "Customer" AS c0 ON c."RequiredCustomerId" = c0."Id" LEFT JOIN "Customer" AS c1 ON c."OptionalCustomerId" = c1."Id" @@ -100,14 +76,16 @@ WHERE c0."ShippingAddress_ZipCode" <> 7728 """); } - // This test fails because when OptionalCustomer is null, we get all-null results because of the LEFT JOIN, and we materialize this - // as an empty ShippingAddress instead of null (see SQL). The proper solution here would be to project the Customer ID just for the - // purpose of knowing that it's there. public override async Task Project_complex_type_via_optional_navigation(bool async) { - var exception = await Assert.ThrowsAsync(() => base.Project_complex_type_via_optional_navigation(async)); + await base.Project_complex_type_via_optional_navigation(async); - Assert.Equal(RelationalStrings.CannotProjectNullableComplexType("Customer.ShippingAddress#Address"), exception.Message); + AssertSql( + """ +SELECT c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +FROM "CustomerGroup" AS c +LEFT JOIN "Customer" AS c0 ON c."OptionalCustomerId" = c0."Id" +"""); } public override async Task Project_complex_type_via_required_navigation(bool async) @@ -130,9 +108,9 @@ public override async Task Load_complex_type_after_subquery_on_entity_type(bool """ @p='1' -SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c ORDER BY c."Id" NULLS FIRST OFFSET @p @@ -202,7 +180,7 @@ public override async Task Complex_type_equals_complex_type(bool async) AssertSql( """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE c."ShippingAddress_AddressLine1" = c."BillingAddress_AddressLine1" AND (c."ShippingAddress_AddressLine2" = c."BillingAddress_AddressLine2" OR (c."ShippingAddress_AddressLine2" IS NULL AND c."BillingAddress_AddressLine2" IS NULL)) AND c."ShippingAddress_Tags" = c."BillingAddress_Tags" AND c."ShippingAddress_ZipCode" = c."BillingAddress_ZipCode" """); @@ -214,7 +192,7 @@ public override async Task Complex_type_equals_constant(bool async) AssertSql( """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE c."ShippingAddress_AddressLine1" = '804 S. Lakeshore Road' AND c."ShippingAddress_AddressLine2" IS NULL AND c."ShippingAddress_Tags" = ARRAY['foo','bar']::text[] AND c."ShippingAddress_ZipCode" = 38654 AND c."ShippingAddress_Country_Code" = 'US' AND c."ShippingAddress_Country_FullName" = 'United States' """); @@ -232,19 +210,12 @@ public override async Task Complex_type_equals_parameter(bool async) @entity_equality_address_Country_Code='US' @entity_equality_address_Country_FullName='United States' -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE c."ShippingAddress_AddressLine1" = @entity_equality_address_AddressLine1 AND c."ShippingAddress_AddressLine2" IS NULL AND c."ShippingAddress_Tags" = @entity_equality_address_Tags AND c."ShippingAddress_ZipCode" = @entity_equality_address_ZipCode AND c."ShippingAddress_Country_Code" = @entity_equality_address_Country_Code AND c."ShippingAddress_Country_FullName" = @entity_equality_address_Country_FullName """); } - public override async Task Complex_type_equals_null(bool async) - { - await base.Complex_type_equals_null(async); - - AssertSql(); - } - public override async Task Subquery_over_complex_type(bool async) { await base.Subquery_over_complex_type(async); @@ -264,7 +235,7 @@ public override async Task Contains_over_complex_type(bool async) @entity_equality_address_Country_Code='US' @entity_equality_address_Country_FullName='United States' -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE EXISTS ( SELECT 1 @@ -295,11 +266,11 @@ public override async Task Concat_entity_type_containing_complex_property(bool a AssertSql( """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE c."Id" = 1 UNION ALL -SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM "Customer" AS c0 WHERE c0."Id" = 2 """); @@ -311,11 +282,11 @@ public override async Task Union_entity_type_containing_complex_property(bool as AssertSql( """ -SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" +SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c WHERE c."Id" = 1 UNION -SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" +SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM "Customer" AS c0 WHERE c0."Id" = 2 """); @@ -469,15 +440,28 @@ WHERE v0."ShippingAddress_ZipCode" <> 7728 """); } - // This test fails because when OptionalCustomer is null, we get all-null results because of the LEFT JOIN, and we materialize this - // as an empty ShippingAddress instead of null (see SQL). The proper solution here would be to project the Customer ID just for the - // purpose of knowing that it's there. public override async Task Project_struct_complex_type_via_optional_navigation(bool async) { - var exception = - await Assert.ThrowsAsync(() => base.Project_struct_complex_type_via_optional_navigation(async)); + await base.Project_struct_complex_type_via_optional_navigation(async); + + AssertSql( + """ +SELECT v0."ShippingAddress_AddressLine1", v0."ShippingAddress_AddressLine2", v0."ShippingAddress_ZipCode", v0."ShippingAddress_Country_Code", v0."ShippingAddress_Country_FullName" +FROM "ValuedCustomerGroup" AS v +LEFT JOIN "ValuedCustomer" AS v0 ON v."OptionalCustomerId" = v0."Id" +"""); + } + + public override async Task Project_nullable_struct_complex_type_via_optional_navigation(bool async) + { + await base.Project_nullable_struct_complex_type_via_optional_navigation(async); - Assert.Equal(RelationalStrings.CannotProjectNullableComplexType("ValuedCustomer.ShippingAddress#AddressStruct"), exception.Message); + AssertSql( + """ +SELECT v0."ShippingAddress_AddressLine1", v0."ShippingAddress_AddressLine2", v0."ShippingAddress_ZipCode", v0."ShippingAddress_Country_Code", v0."ShippingAddress_Country_FullName" +FROM "ValuedCustomerGroup" AS v +LEFT JOIN "ValuedCustomer" AS v0 ON v."OptionalCustomerId" = v0."Id" +"""); } public override async Task Project_struct_complex_type_via_required_navigation(bool async) @@ -745,10 +729,10 @@ public override async Task Project_same_entity_with_nested_complex_type_twice_wi await base.Project_same_entity_with_nested_complex_type_twice_with_pushdown(async); AssertSql( -""" -SELECT s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0" + """ +SELECT s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."OptionalAddress_AddressLine1", s."OptionalAddress_AddressLine2", s."OptionalAddress_Tags", s."OptionalAddress_ZipCode", s."OptionalAddress_Country_Code", s."OptionalAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."OptionalAddress_AddressLine10", s."OptionalAddress_AddressLine20", s."OptionalAddress_Tags0", s."OptionalAddress_ZipCode0", s."OptionalAddress_Country_Code0", s."OptionalAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0" FROM ( - SELECT DISTINCT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT DISTINCT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c0."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c0."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c0."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c0."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c0."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c CROSS JOIN "Customer" AS c0 ) AS s @@ -778,11 +762,11 @@ public override async Task Project_same_entity_with_nested_complex_type_twice_wi """ @p='50' -SELECT s0."Id", s0."Name", s0."BillingAddress_AddressLine1", s0."BillingAddress_AddressLine2", s0."BillingAddress_Tags", s0."BillingAddress_ZipCode", s0."BillingAddress_Country_Code", s0."BillingAddress_Country_FullName", s0."ShippingAddress_AddressLine1", s0."ShippingAddress_AddressLine2", s0."ShippingAddress_Tags", s0."ShippingAddress_ZipCode", s0."ShippingAddress_Country_Code", s0."ShippingAddress_Country_FullName", s0."Id0", s0."Name0", s0."BillingAddress_AddressLine10", s0."BillingAddress_AddressLine20", s0."BillingAddress_Tags0", s0."BillingAddress_ZipCode0", s0."BillingAddress_Country_Code0", s0."BillingAddress_Country_FullName0", s0."ShippingAddress_AddressLine10", s0."ShippingAddress_AddressLine20", s0."ShippingAddress_Tags0", s0."ShippingAddress_ZipCode0", s0."ShippingAddress_Country_Code0", s0."ShippingAddress_Country_FullName0" +SELECT s0."Id", s0."Name", s0."BillingAddress_AddressLine1", s0."BillingAddress_AddressLine2", s0."BillingAddress_Tags", s0."BillingAddress_ZipCode", s0."BillingAddress_Country_Code", s0."BillingAddress_Country_FullName", s0."OptionalAddress_AddressLine1", s0."OptionalAddress_AddressLine2", s0."OptionalAddress_Tags", s0."OptionalAddress_ZipCode", s0."OptionalAddress_Country_Code", s0."OptionalAddress_Country_FullName", s0."ShippingAddress_AddressLine1", s0."ShippingAddress_AddressLine2", s0."ShippingAddress_Tags", s0."ShippingAddress_ZipCode", s0."ShippingAddress_Country_Code", s0."ShippingAddress_Country_FullName", s0."Id0", s0."Name0", s0."BillingAddress_AddressLine10", s0."BillingAddress_AddressLine20", s0."BillingAddress_Tags0", s0."BillingAddress_ZipCode0", s0."BillingAddress_Country_Code0", s0."BillingAddress_Country_FullName0", s0."OptionalAddress_AddressLine10", s0."OptionalAddress_AddressLine20", s0."OptionalAddress_Tags0", s0."OptionalAddress_ZipCode0", s0."OptionalAddress_Country_Code0", s0."OptionalAddress_Country_FullName0", s0."ShippingAddress_AddressLine10", s0."ShippingAddress_AddressLine20", s0."ShippingAddress_Tags0", s0."ShippingAddress_ZipCode0", s0."ShippingAddress_Country_Code0", s0."ShippingAddress_Country_FullName0" FROM ( - SELECT DISTINCT s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0" + SELECT DISTINCT s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."OptionalAddress_AddressLine1", s."OptionalAddress_AddressLine2", s."OptionalAddress_Tags", s."OptionalAddress_ZipCode", s."OptionalAddress_Country_Code", s."OptionalAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."OptionalAddress_AddressLine10", s."OptionalAddress_AddressLine20", s."OptionalAddress_Tags0", s."OptionalAddress_ZipCode0", s."OptionalAddress_Country_Code0", s."OptionalAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c0."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c0."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c0."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c0."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c0."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c CROSS JOIN "Customer" AS c0 ORDER BY c."Id" NULLS FIRST, c0."Id" NULLS FIRST @@ -896,13 +880,13 @@ public override async Task Union_of_same_entity_with_nested_complex_type_project """ @p='50' -SELECT u."Id", u."Name", u."BillingAddress_AddressLine1", u."BillingAddress_AddressLine2", u."BillingAddress_Tags", u."BillingAddress_ZipCode", u."BillingAddress_Country_Code", u."BillingAddress_Country_FullName", u."ShippingAddress_AddressLine1", u."ShippingAddress_AddressLine2", u."ShippingAddress_Tags", u."ShippingAddress_ZipCode", u."ShippingAddress_Country_Code", u."ShippingAddress_Country_FullName", u."Id0", u."Name0", u."BillingAddress_AddressLine10", u."BillingAddress_AddressLine20", u."BillingAddress_Tags0", u."BillingAddress_ZipCode0", u."BillingAddress_Country_Code0", u."BillingAddress_Country_FullName0", u."ShippingAddress_AddressLine10", u."ShippingAddress_AddressLine20", u."ShippingAddress_Tags0", u."ShippingAddress_ZipCode0", u."ShippingAddress_Country_Code0", u."ShippingAddress_Country_FullName0" +SELECT u."Id", u."Name", u."BillingAddress_AddressLine1", u."BillingAddress_AddressLine2", u."BillingAddress_Tags", u."BillingAddress_ZipCode", u."BillingAddress_Country_Code", u."BillingAddress_Country_FullName", u."OptionalAddress_AddressLine1", u."OptionalAddress_AddressLine2", u."OptionalAddress_Tags", u."OptionalAddress_ZipCode", u."OptionalAddress_Country_Code", u."OptionalAddress_Country_FullName", u."ShippingAddress_AddressLine1", u."ShippingAddress_AddressLine2", u."ShippingAddress_Tags", u."ShippingAddress_ZipCode", u."ShippingAddress_Country_Code", u."ShippingAddress_Country_FullName", u."Id0", u."Name0", u."BillingAddress_AddressLine10", u."BillingAddress_AddressLine20", u."BillingAddress_Tags0", u."BillingAddress_ZipCode0", u."BillingAddress_Country_Code0", u."BillingAddress_Country_FullName0", u."OptionalAddress_AddressLine10", u."OptionalAddress_AddressLine20", u."OptionalAddress_Tags0", u."OptionalAddress_ZipCode0", u."OptionalAddress_Country_Code0", u."OptionalAddress_Country_FullName0", u."ShippingAddress_AddressLine10", u."ShippingAddress_AddressLine20", u."ShippingAddress_Tags0", u."ShippingAddress_ZipCode0", u."ShippingAddress_Country_Code0", u."ShippingAddress_Country_FullName0" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c0."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c0."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c0."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c0."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c0."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c CROSS JOIN "Customer" AS c0 UNION - SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c2."Id" AS "Id0", c2."Name" AS "Name0", c2."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c2."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c2."BillingAddress_Tags" AS "BillingAddress_Tags0", c2."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c2."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c2."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c2."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c2."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c2."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c2."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c2."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c2."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."OptionalAddress_AddressLine1", c1."OptionalAddress_AddressLine2", c1."OptionalAddress_Tags", c1."OptionalAddress_ZipCode", c1."OptionalAddress_Country_Code", c1."OptionalAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c2."Id" AS "Id0", c2."Name" AS "Name0", c2."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c2."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c2."BillingAddress_Tags" AS "BillingAddress_Tags0", c2."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c2."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c2."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c2."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c2."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c2."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c2."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c2."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c2."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c2."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c2."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c2."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c2."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c2."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c2."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c1 CROSS JOIN "Customer" AS c2 ) AS u @@ -919,17 +903,17 @@ public override async Task Union_of_same_entity_with_nested_complex_type_project """ @p='50' -SELECT u1."Id", u1."Name", u1."BillingAddress_AddressLine1", u1."BillingAddress_AddressLine2", u1."BillingAddress_Tags", u1."BillingAddress_ZipCode", u1."BillingAddress_Country_Code", u1."BillingAddress_Country_FullName", u1."ShippingAddress_AddressLine1", u1."ShippingAddress_AddressLine2", u1."ShippingAddress_Tags", u1."ShippingAddress_ZipCode", u1."ShippingAddress_Country_Code", u1."ShippingAddress_Country_FullName", u1."Id0", u1."Name0", u1."BillingAddress_AddressLine10", u1."BillingAddress_AddressLine20", u1."BillingAddress_Tags0", u1."BillingAddress_ZipCode0", u1."BillingAddress_Country_Code0", u1."BillingAddress_Country_FullName0", u1."ShippingAddress_AddressLine10", u1."ShippingAddress_AddressLine20", u1."ShippingAddress_Tags0", u1."ShippingAddress_ZipCode0", u1."ShippingAddress_Country_Code0", u1."ShippingAddress_Country_FullName0" +SELECT u1."Id", u1."Name", u1."BillingAddress_AddressLine1", u1."BillingAddress_AddressLine2", u1."BillingAddress_Tags", u1."BillingAddress_ZipCode", u1."BillingAddress_Country_Code", u1."BillingAddress_Country_FullName", u1."OptionalAddress_AddressLine1", u1."OptionalAddress_AddressLine2", u1."OptionalAddress_Tags", u1."OptionalAddress_ZipCode", u1."OptionalAddress_Country_Code", u1."OptionalAddress_Country_FullName", u1."ShippingAddress_AddressLine1", u1."ShippingAddress_AddressLine2", u1."ShippingAddress_Tags", u1."ShippingAddress_ZipCode", u1."ShippingAddress_Country_Code", u1."ShippingAddress_Country_FullName", u1."Id0", u1."Name0", u1."BillingAddress_AddressLine10", u1."BillingAddress_AddressLine20", u1."BillingAddress_Tags0", u1."BillingAddress_ZipCode0", u1."BillingAddress_Country_Code0", u1."BillingAddress_Country_FullName0", u1."OptionalAddress_AddressLine10", u1."OptionalAddress_AddressLine20", u1."OptionalAddress_Tags0", u1."OptionalAddress_ZipCode0", u1."OptionalAddress_Country_Code0", u1."OptionalAddress_Country_FullName0", u1."ShippingAddress_AddressLine10", u1."ShippingAddress_AddressLine20", u1."ShippingAddress_Tags0", u1."ShippingAddress_ZipCode0", u1."ShippingAddress_Country_Code0", u1."ShippingAddress_Country_FullName0" FROM ( - SELECT DISTINCT u0."Id", u0."Name", u0."BillingAddress_AddressLine1", u0."BillingAddress_AddressLine2", u0."BillingAddress_Tags", u0."BillingAddress_ZipCode", u0."BillingAddress_Country_Code", u0."BillingAddress_Country_FullName", u0."ShippingAddress_AddressLine1", u0."ShippingAddress_AddressLine2", u0."ShippingAddress_Tags", u0."ShippingAddress_ZipCode", u0."ShippingAddress_Country_Code", u0."ShippingAddress_Country_FullName", u0."Id0", u0."Name0", u0."BillingAddress_AddressLine10", u0."BillingAddress_AddressLine20", u0."BillingAddress_Tags0", u0."BillingAddress_ZipCode0", u0."BillingAddress_Country_Code0", u0."BillingAddress_Country_FullName0", u0."ShippingAddress_AddressLine10", u0."ShippingAddress_AddressLine20", u0."ShippingAddress_Tags0", u0."ShippingAddress_ZipCode0", u0."ShippingAddress_Country_Code0", u0."ShippingAddress_Country_FullName0" + SELECT DISTINCT u0."Id", u0."Name", u0."BillingAddress_AddressLine1", u0."BillingAddress_AddressLine2", u0."BillingAddress_Tags", u0."BillingAddress_ZipCode", u0."BillingAddress_Country_Code", u0."BillingAddress_Country_FullName", u0."OptionalAddress_AddressLine1", u0."OptionalAddress_AddressLine2", u0."OptionalAddress_Tags", u0."OptionalAddress_ZipCode", u0."OptionalAddress_Country_Code", u0."OptionalAddress_Country_FullName", u0."ShippingAddress_AddressLine1", u0."ShippingAddress_AddressLine2", u0."ShippingAddress_Tags", u0."ShippingAddress_ZipCode", u0."ShippingAddress_Country_Code", u0."ShippingAddress_Country_FullName", u0."Id0", u0."Name0", u0."BillingAddress_AddressLine10", u0."BillingAddress_AddressLine20", u0."BillingAddress_Tags0", u0."BillingAddress_ZipCode0", u0."BillingAddress_Country_Code0", u0."BillingAddress_Country_FullName0", u0."OptionalAddress_AddressLine10", u0."OptionalAddress_AddressLine20", u0."OptionalAddress_Tags0", u0."OptionalAddress_ZipCode0", u0."OptionalAddress_Country_Code0", u0."OptionalAddress_Country_FullName0", u0."ShippingAddress_AddressLine10", u0."ShippingAddress_AddressLine20", u0."ShippingAddress_Tags0", u0."ShippingAddress_ZipCode0", u0."ShippingAddress_Country_Code0", u0."ShippingAddress_Country_FullName0" FROM ( - SELECT u."Id", u."Name", u."BillingAddress_AddressLine1", u."BillingAddress_AddressLine2", u."BillingAddress_Tags", u."BillingAddress_ZipCode", u."BillingAddress_Country_Code", u."BillingAddress_Country_FullName", u."ShippingAddress_AddressLine1", u."ShippingAddress_AddressLine2", u."ShippingAddress_Tags", u."ShippingAddress_ZipCode", u."ShippingAddress_Country_Code", u."ShippingAddress_Country_FullName", u."Id0", u."Name0", u."BillingAddress_AddressLine10", u."BillingAddress_AddressLine20", u."BillingAddress_Tags0", u."BillingAddress_ZipCode0", u."BillingAddress_Country_Code0", u."BillingAddress_Country_FullName0", u."ShippingAddress_AddressLine10", u."ShippingAddress_AddressLine20", u."ShippingAddress_Tags0", u."ShippingAddress_ZipCode0", u."ShippingAddress_Country_Code0", u."ShippingAddress_Country_FullName0" + SELECT u."Id", u."Name", u."BillingAddress_AddressLine1", u."BillingAddress_AddressLine2", u."BillingAddress_Tags", u."BillingAddress_ZipCode", u."BillingAddress_Country_Code", u."BillingAddress_Country_FullName", u."OptionalAddress_AddressLine1", u."OptionalAddress_AddressLine2", u."OptionalAddress_Tags", u."OptionalAddress_ZipCode", u."OptionalAddress_Country_Code", u."OptionalAddress_Country_FullName", u."ShippingAddress_AddressLine1", u."ShippingAddress_AddressLine2", u."ShippingAddress_Tags", u."ShippingAddress_ZipCode", u."ShippingAddress_Country_Code", u."ShippingAddress_Country_FullName", u."Id0", u."Name0", u."BillingAddress_AddressLine10", u."BillingAddress_AddressLine20", u."BillingAddress_Tags0", u."BillingAddress_ZipCode0", u."BillingAddress_Country_Code0", u."BillingAddress_Country_FullName0", u."OptionalAddress_AddressLine10", u."OptionalAddress_AddressLine20", u."OptionalAddress_Tags0", u."OptionalAddress_ZipCode0", u."OptionalAddress_Country_Code0", u."OptionalAddress_Country_FullName0", u."ShippingAddress_AddressLine10", u."ShippingAddress_AddressLine20", u."ShippingAddress_Tags0", u."ShippingAddress_ZipCode0", u."ShippingAddress_Country_Code0", u."ShippingAddress_Country_FullName0" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName", c0."Id" AS "Id0", c0."Name" AS "Name0", c0."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c0."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c0."BillingAddress_Tags" AS "BillingAddress_Tags0", c0."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c0."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c0."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c0."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c0."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c0."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c0."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c0."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c0."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c0."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c0."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c0."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c0."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c0."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c0."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c CROSS JOIN "Customer" AS c0 UNION - SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c2."Id" AS "Id0", c2."Name" AS "Name0", c2."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c2."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c2."BillingAddress_Tags" AS "BillingAddress_Tags0", c2."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c2."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c2."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c2."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c2."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c2."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c2."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c2."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c2."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" + SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."OptionalAddress_AddressLine1", c1."OptionalAddress_AddressLine2", c1."OptionalAddress_Tags", c1."OptionalAddress_ZipCode", c1."OptionalAddress_Country_Code", c1."OptionalAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName", c2."Id" AS "Id0", c2."Name" AS "Name0", c2."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c2."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c2."BillingAddress_Tags" AS "BillingAddress_Tags0", c2."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c2."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c2."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c2."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c2."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c2."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c2."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c2."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c2."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c2."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c2."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c2."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c2."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c2."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c2."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0" FROM "Customer" AS c1 CROSS JOIN "Customer" AS c2 ) AS u @@ -1002,10 +986,10 @@ public override async Task Same_entity_with_complex_type_projected_twice_with_pu AssertSql( """ -SELECT c."Id", s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0", s.c +SELECT c."Id", s."Id", s."Name", s."BillingAddress_AddressLine1", s."BillingAddress_AddressLine2", s."BillingAddress_Tags", s."BillingAddress_ZipCode", s."BillingAddress_Country_Code", s."BillingAddress_Country_FullName", s."OptionalAddress_AddressLine1", s."OptionalAddress_AddressLine2", s."OptionalAddress_Tags", s."OptionalAddress_ZipCode", s."OptionalAddress_Country_Code", s."OptionalAddress_Country_FullName", s."ShippingAddress_AddressLine1", s."ShippingAddress_AddressLine2", s."ShippingAddress_Tags", s."ShippingAddress_ZipCode", s."ShippingAddress_Country_Code", s."ShippingAddress_Country_FullName", s."Id0", s."Name0", s."BillingAddress_AddressLine10", s."BillingAddress_AddressLine20", s."BillingAddress_Tags0", s."BillingAddress_ZipCode0", s."BillingAddress_Country_Code0", s."BillingAddress_Country_FullName0", s."OptionalAddress_AddressLine10", s."OptionalAddress_AddressLine20", s."OptionalAddress_Tags0", s."OptionalAddress_ZipCode0", s."OptionalAddress_Country_Code0", s."OptionalAddress_Country_FullName0", s."ShippingAddress_AddressLine10", s."ShippingAddress_AddressLine20", s."ShippingAddress_Tags0", s."ShippingAddress_ZipCode0", s."ShippingAddress_Country_Code0", s."ShippingAddress_Country_FullName0", s.c FROM "Customer" AS c LEFT JOIN LATERAL ( - SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", c1."Id" AS "Id0", c1."Name" AS "Name0", c1."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c1."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c1."BillingAddress_Tags" AS "BillingAddress_Tags0", c1."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c1."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c1."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c1."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c1."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c1."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c1."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c1."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c1."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0", 1 AS c + SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", c1."Id" AS "Id0", c1."Name" AS "Name0", c1."BillingAddress_AddressLine1" AS "BillingAddress_AddressLine10", c1."BillingAddress_AddressLine2" AS "BillingAddress_AddressLine20", c1."BillingAddress_Tags" AS "BillingAddress_Tags0", c1."BillingAddress_ZipCode" AS "BillingAddress_ZipCode0", c1."BillingAddress_Country_Code" AS "BillingAddress_Country_Code0", c1."BillingAddress_Country_FullName" AS "BillingAddress_Country_FullName0", c1."OptionalAddress_AddressLine1" AS "OptionalAddress_AddressLine10", c1."OptionalAddress_AddressLine2" AS "OptionalAddress_AddressLine20", c1."OptionalAddress_Tags" AS "OptionalAddress_Tags0", c1."OptionalAddress_ZipCode" AS "OptionalAddress_ZipCode0", c1."OptionalAddress_Country_Code" AS "OptionalAddress_Country_Code0", c1."OptionalAddress_Country_FullName" AS "OptionalAddress_Country_FullName0", c1."ShippingAddress_AddressLine1" AS "ShippingAddress_AddressLine10", c1."ShippingAddress_AddressLine2" AS "ShippingAddress_AddressLine20", c1."ShippingAddress_Tags" AS "ShippingAddress_Tags0", c1."ShippingAddress_ZipCode" AS "ShippingAddress_ZipCode0", c1."ShippingAddress_Country_Code" AS "ShippingAddress_Country_Code0", c1."ShippingAddress_Country_FullName" AS "ShippingAddress_Country_FullName0", 1 AS c FROM "Customer" AS c0 CROSS JOIN "Customer" AS c1 ORDER BY c0."Id" NULLS FIRST, c1."Id" DESC NULLS LAST @@ -1065,16 +1049,16 @@ public override async Task Entity_with_complex_type_with_group_by_and_first(bool AssertSql( """ -SELECT c3."Id", c3."Name", c3."BillingAddress_AddressLine1", c3."BillingAddress_AddressLine2", c3."BillingAddress_Tags", c3."BillingAddress_ZipCode", c3."BillingAddress_Country_Code", c3."BillingAddress_Country_FullName", c3."ShippingAddress_AddressLine1", c3."ShippingAddress_AddressLine2", c3."ShippingAddress_Tags", c3."ShippingAddress_ZipCode", c3."ShippingAddress_Country_Code", c3."ShippingAddress_Country_FullName" +SELECT c3."Id", c3."Name", c3."BillingAddress_AddressLine1", c3."BillingAddress_AddressLine2", c3."BillingAddress_Tags", c3."BillingAddress_ZipCode", c3."BillingAddress_Country_Code", c3."BillingAddress_Country_FullName", c3."OptionalAddress_AddressLine1", c3."OptionalAddress_AddressLine2", c3."OptionalAddress_Tags", c3."OptionalAddress_ZipCode", c3."OptionalAddress_Country_Code", c3."OptionalAddress_Country_FullName", c3."ShippingAddress_AddressLine1", c3."ShippingAddress_AddressLine2", c3."ShippingAddress_Tags", c3."ShippingAddress_ZipCode", c3."ShippingAddress_Country_Code", c3."ShippingAddress_Country_FullName" FROM ( SELECT c."Id" FROM "Customer" AS c GROUP BY c."Id" ) AS c1 LEFT JOIN ( - SELECT c2."Id", c2."Name", c2."BillingAddress_AddressLine1", c2."BillingAddress_AddressLine2", c2."BillingAddress_Tags", c2."BillingAddress_ZipCode", c2."BillingAddress_Country_Code", c2."BillingAddress_Country_FullName", c2."ShippingAddress_AddressLine1", c2."ShippingAddress_AddressLine2", c2."ShippingAddress_Tags", c2."ShippingAddress_ZipCode", c2."ShippingAddress_Country_Code", c2."ShippingAddress_Country_FullName" + SELECT c2."Id", c2."Name", c2."BillingAddress_AddressLine1", c2."BillingAddress_AddressLine2", c2."BillingAddress_Tags", c2."BillingAddress_ZipCode", c2."BillingAddress_Country_Code", c2."BillingAddress_Country_FullName", c2."OptionalAddress_AddressLine1", c2."OptionalAddress_AddressLine2", c2."OptionalAddress_Tags", c2."OptionalAddress_ZipCode", c2."OptionalAddress_Country_Code", c2."OptionalAddress_Country_FullName", c2."ShippingAddress_AddressLine1", c2."ShippingAddress_AddressLine2", c2."ShippingAddress_Tags", c2."ShippingAddress_ZipCode", c2."ShippingAddress_Country_Code", c2."ShippingAddress_Country_FullName" FROM ( - SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", ROW_NUMBER() OVER(PARTITION BY c0."Id" ORDER BY c0."Id" NULLS FIRST) AS row + SELECT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName", ROW_NUMBER() OVER(PARTITION BY c0."Id" ORDER BY c0."Id" NULLS FIRST) AS row FROM "Customer" AS c0 ) AS c2 WHERE c2.row <= 1 @@ -1132,18 +1116,18 @@ public override async Task Project_entity_with_complex_type_pushdown_and_then_le SELECT c3."BillingAddress_ZipCode" AS "Zip1", c4."ShippingAddress_ZipCode" AS "Zip2" FROM ( - SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" + SELECT DISTINCT c0."Id", c0."Name", c0."BillingAddress_AddressLine1", c0."BillingAddress_AddressLine2", c0."BillingAddress_Tags", c0."BillingAddress_ZipCode", c0."BillingAddress_Country_Code", c0."BillingAddress_Country_FullName", c0."OptionalAddress_AddressLine1", c0."OptionalAddress_AddressLine2", c0."OptionalAddress_Tags", c0."OptionalAddress_ZipCode", c0."OptionalAddress_Country_Code", c0."OptionalAddress_Country_FullName", c0."ShippingAddress_AddressLine1", c0."ShippingAddress_AddressLine2", c0."ShippingAddress_Tags", c0."ShippingAddress_ZipCode", c0."ShippingAddress_Country_Code", c0."ShippingAddress_Country_FullName" FROM ( - SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" + SELECT c."Id", c."Name", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."BillingAddress_Country_Code", c."BillingAddress_Country_FullName", c."OptionalAddress_AddressLine1", c."OptionalAddress_AddressLine2", c."OptionalAddress_Tags", c."OptionalAddress_ZipCode", c."OptionalAddress_Country_Code", c."OptionalAddress_Country_FullName", c."ShippingAddress_AddressLine1", c."ShippingAddress_AddressLine2", c."ShippingAddress_Tags", c."ShippingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName" FROM "Customer" AS c ORDER BY c."Id" NULLS FIRST LIMIT @p ) AS c0 ) AS c3 LEFT JOIN ( - SELECT DISTINCT c2."Id", c2."Name", c2."BillingAddress_AddressLine1", c2."BillingAddress_AddressLine2", c2."BillingAddress_Tags", c2."BillingAddress_ZipCode", c2."BillingAddress_Country_Code", c2."BillingAddress_Country_FullName", c2."ShippingAddress_AddressLine1", c2."ShippingAddress_AddressLine2", c2."ShippingAddress_Tags", c2."ShippingAddress_ZipCode", c2."ShippingAddress_Country_Code", c2."ShippingAddress_Country_FullName" + SELECT DISTINCT c2."Id", c2."Name", c2."BillingAddress_AddressLine1", c2."BillingAddress_AddressLine2", c2."BillingAddress_Tags", c2."BillingAddress_ZipCode", c2."BillingAddress_Country_Code", c2."BillingAddress_Country_FullName", c2."OptionalAddress_AddressLine1", c2."OptionalAddress_AddressLine2", c2."OptionalAddress_Tags", c2."OptionalAddress_ZipCode", c2."OptionalAddress_Country_Code", c2."OptionalAddress_Country_FullName", c2."ShippingAddress_AddressLine1", c2."ShippingAddress_AddressLine2", c2."ShippingAddress_Tags", c2."ShippingAddress_ZipCode", c2."ShippingAddress_Country_Code", c2."ShippingAddress_Country_FullName" FROM ( - SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName" + SELECT c1."Id", c1."Name", c1."BillingAddress_AddressLine1", c1."BillingAddress_AddressLine2", c1."BillingAddress_Tags", c1."BillingAddress_ZipCode", c1."BillingAddress_Country_Code", c1."BillingAddress_Country_FullName", c1."OptionalAddress_AddressLine1", c1."OptionalAddress_AddressLine2", c1."OptionalAddress_Tags", c1."OptionalAddress_ZipCode", c1."OptionalAddress_Country_Code", c1."OptionalAddress_Country_FullName", c1."ShippingAddress_AddressLine1", c1."ShippingAddress_AddressLine2", c1."ShippingAddress_Tags", c1."ShippingAddress_ZipCode", c1."ShippingAddress_Country_Code", c1."ShippingAddress_Country_FullName" FROM "Customer" AS c1 ORDER BY c1."Id" DESC NULLS LAST LIMIT @p0 diff --git a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs index 5de647bc1f..c767280294 100644 --- a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs @@ -10,9 +10,9 @@ public PrimitiveCollectionsQueryNpgsqlTest(PrimitiveCollectionsQueryNpgsqlFixtur Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Inline_collection_of_ints_Contains(bool async) + public override async Task Inline_collection_of_ints_Contains() { - await base.Inline_collection_of_ints_Contains(async); + await base.Inline_collection_of_ints_Contains(); AssertSql( """ @@ -22,9 +22,9 @@ public override async Task Inline_collection_of_ints_Contains(bool async) """); } - public override async Task Inline_collection_of_nullable_ints_Contains(bool async) + public override async Task Inline_collection_of_nullable_ints_Contains() { - await base.Inline_collection_of_nullable_ints_Contains(async); + await base.Inline_collection_of_nullable_ints_Contains(); AssertSql( """ @@ -34,9 +34,9 @@ public override async Task Inline_collection_of_nullable_ints_Contains(bool asyn """); } - public override async Task Inline_collection_of_nullable_ints_Contains_null(bool async) + public override async Task Inline_collection_of_nullable_ints_Contains_null() { - await base.Inline_collection_of_nullable_ints_Contains_null(async); + await base.Inline_collection_of_nullable_ints_Contains_null(); AssertSql( """ @@ -46,16 +46,16 @@ public override async Task Inline_collection_of_nullable_ints_Contains_null(bool """); } - public override async Task Inline_collection_Count_with_zero_values(bool async) + public override async Task Inline_collection_Count_with_zero_values() { - await base.Inline_collection_Count_with_zero_values(async); + await base.Inline_collection_Count_with_zero_values(); AssertSql(); } - public override async Task Inline_collection_Count_with_one_value(bool async) + public override async Task Inline_collection_Count_with_one_value() { - await base.Inline_collection_Count_with_one_value(async); + await base.Inline_collection_Count_with_one_value(); AssertSql( """ @@ -68,9 +68,9 @@ SELECT count(*)::int """); } - public override async Task Inline_collection_Count_with_two_values(bool async) + public override async Task Inline_collection_Count_with_two_values() { - await base.Inline_collection_Count_with_two_values(async); + await base.Inline_collection_Count_with_two_values(); AssertSql( """ @@ -83,9 +83,9 @@ SELECT count(*)::int """); } - public override async Task Inline_collection_Count_with_three_values(bool async) + public override async Task Inline_collection_Count_with_three_values() { - await base.Inline_collection_Count_with_three_values(async); + await base.Inline_collection_Count_with_three_values(); AssertSql( """ @@ -98,9 +98,9 @@ SELECT count(*)::int """); } - public override async Task Inline_collection_Contains_with_zero_values(bool async) + public override async Task Inline_collection_Contains_with_zero_values() { - await base.Inline_collection_Contains_with_zero_values(async); + await base.Inline_collection_Contains_with_zero_values(); AssertSql( """ @@ -110,9 +110,9 @@ WHERE FALSE """); } - public override async Task Inline_collection_Contains_with_one_value(bool async) + public override async Task Inline_collection_Contains_with_one_value() { - await base.Inline_collection_Contains_with_one_value(async); + await base.Inline_collection_Contains_with_one_value(); AssertSql( """ @@ -122,9 +122,9 @@ public override async Task Inline_collection_Contains_with_one_value(bool async) """); } - public override async Task Inline_collection_Contains_with_two_values(bool async) + public override async Task Inline_collection_Contains_with_two_values() { - await base.Inline_collection_Contains_with_two_values(async); + await base.Inline_collection_Contains_with_two_values(); AssertSql( """ @@ -134,9 +134,9 @@ public override async Task Inline_collection_Contains_with_two_values(bool async """); } - public override async Task Inline_collection_Contains_with_three_values(bool async) + public override async Task Inline_collection_Contains_with_three_values() { - await base.Inline_collection_Contains_with_three_values(async); + await base.Inline_collection_Contains_with_three_values(); AssertSql( """ @@ -146,9 +146,9 @@ public override async Task Inline_collection_Contains_with_three_values(bool asy """); } - public override async Task Inline_collection_Contains_with_all_parameters(bool async) + public override async Task Inline_collection_Contains_with_all_parameters() { - await base.Inline_collection_Contains_with_all_parameters(async); + await base.Inline_collection_Contains_with_all_parameters(); AssertSql( """ @@ -161,9 +161,9 @@ public override async Task Inline_collection_Contains_with_all_parameters(bool a """); } - public override async Task Inline_collection_Contains_with_constant_and_parameter(bool async) + public override async Task Inline_collection_Contains_with_constant_and_parameter() { - await base.Inline_collection_Contains_with_constant_and_parameter(async); + await base.Inline_collection_Contains_with_constant_and_parameter(); AssertSql( """ @@ -175,9 +175,9 @@ public override async Task Inline_collection_Contains_with_constant_and_paramete """); } - public override async Task Inline_collection_Contains_with_mixed_value_types(bool async) + public override async Task Inline_collection_Contains_with_mixed_value_types() { - await base.Inline_collection_Contains_with_mixed_value_types(async); + await base.Inline_collection_Contains_with_mixed_value_types(); AssertSql( """ @@ -189,9 +189,9 @@ public override async Task Inline_collection_Contains_with_mixed_value_types(boo """); } - public override async Task Inline_collection_List_Contains_with_mixed_value_types(bool async) + public override async Task Inline_collection_List_Contains_with_mixed_value_types() { - await base.Inline_collection_List_Contains_with_mixed_value_types(async); + await base.Inline_collection_List_Contains_with_mixed_value_types(); AssertSql( """ @@ -203,9 +203,9 @@ public override async Task Inline_collection_List_Contains_with_mixed_value_type """); } - public override async Task Inline_collection_Contains_as_Any_with_predicate(bool async) + public override async Task Inline_collection_Contains_as_Any_with_predicate() { - await base.Inline_collection_Contains_as_Any_with_predicate(async); + await base.Inline_collection_Contains_as_Any_with_predicate(); AssertSql( """ @@ -215,9 +215,9 @@ public override async Task Inline_collection_Contains_as_Any_with_predicate(bool """); } - public override async Task Inline_collection_negated_Contains_as_All(bool async) + public override async Task Inline_collection_negated_Contains_as_All() { - await base.Inline_collection_negated_Contains_as_All(async); + await base.Inline_collection_negated_Contains_as_All(); AssertSql( """ @@ -227,9 +227,9 @@ public override async Task Inline_collection_negated_Contains_as_All(bool async) """); } - public override async Task Inline_collection_Min_with_two_values(bool async) + public override async Task Inline_collection_Min_with_two_values() { - await base.Inline_collection_Min_with_two_values(async); + await base.Inline_collection_Min_with_two_values(); AssertSql( """ @@ -239,9 +239,9 @@ WHERE LEAST(30, p."Int") = 30 """); } - public override async Task Inline_collection_List_Min_with_two_values(bool async) + public override async Task Inline_collection_List_Min_with_two_values() { - await base.Inline_collection_List_Min_with_two_values(async); + await base.Inline_collection_List_Min_with_two_values(); AssertSql( """ @@ -251,9 +251,9 @@ WHERE LEAST(30, p."Int") = 30 """); } - public override async Task Inline_collection_Max_with_two_values(bool async) + public override async Task Inline_collection_Max_with_two_values() { - await base.Inline_collection_Max_with_two_values(async); + await base.Inline_collection_Max_with_two_values(); AssertSql( """ @@ -263,9 +263,9 @@ WHERE GREATEST(30, p."Int") = 30 """); } - public override async Task Inline_collection_List_Max_with_two_values(bool async) + public override async Task Inline_collection_List_Max_with_two_values() { - await base.Inline_collection_List_Max_with_two_values(async); + await base.Inline_collection_List_Max_with_two_values(); AssertSql( """ @@ -275,9 +275,9 @@ WHERE GREATEST(30, p."Int") = 30 """); } - public override async Task Inline_collection_Min_with_three_values(bool async) + public override async Task Inline_collection_Min_with_three_values() { - await base.Inline_collection_Min_with_three_values(async); + await base.Inline_collection_Min_with_three_values(); AssertSql( """ @@ -289,9 +289,9 @@ WHERE LEAST(30, p."Int", @i) = 25 """); } - public override async Task Inline_collection_List_Min_with_three_values(bool async) + public override async Task Inline_collection_List_Min_with_three_values() { - await base.Inline_collection_List_Min_with_three_values(async); + await base.Inline_collection_List_Min_with_three_values(); AssertSql( """ @@ -303,9 +303,9 @@ WHERE LEAST(30, p."Int", @i) = 25 """); } - public override async Task Inline_collection_Max_with_three_values(bool async) + public override async Task Inline_collection_Max_with_three_values() { - await base.Inline_collection_Max_with_three_values(async); + await base.Inline_collection_Max_with_three_values(); AssertSql( """ @@ -317,9 +317,9 @@ WHERE GREATEST(30, p."Int", @i) = 35 """); } - public override async Task Inline_collection_List_Max_with_three_values(bool async) + public override async Task Inline_collection_List_Max_with_three_values() { - await base.Inline_collection_List_Max_with_three_values(async); + await base.Inline_collection_List_Max_with_three_values(); AssertSql( """ @@ -331,9 +331,9 @@ WHERE GREATEST(30, p."Int", @i) = 35 """); } - public override async Task Inline_collection_of_nullable_value_type_Min(bool async) + public override async Task Inline_collection_of_nullable_value_type_Min() { - await base.Inline_collection_of_nullable_value_type_Min(async); + await base.Inline_collection_of_nullable_value_type_Min(); AssertSql( """ @@ -345,9 +345,9 @@ WHERE LEAST(30, p."Int", @i) = 25 """); } - public override async Task Inline_collection_of_nullable_value_type_Max(bool async) + public override async Task Inline_collection_of_nullable_value_type_Max() { - await base.Inline_collection_of_nullable_value_type_Max(async); + await base.Inline_collection_of_nullable_value_type_Max(); AssertSql( """ @@ -359,9 +359,9 @@ WHERE GREATEST(30, p."Int", @i) = 35 """); } - public override async Task Inline_collection_of_nullable_value_type_with_null_Min(bool async) + public override async Task Inline_collection_of_nullable_value_type_with_null_Min() { - await base.Inline_collection_of_nullable_value_type_with_null_Min(async); + await base.Inline_collection_of_nullable_value_type_with_null_Min(); AssertSql( """ @@ -371,9 +371,9 @@ WHERE LEAST(30, p."NullableInt", NULL) = 30 """); } - public override async Task Inline_collection_of_nullable_value_type_with_null_Max(bool async) + public override async Task Inline_collection_of_nullable_value_type_with_null_Max() { - await base.Inline_collection_of_nullable_value_type_with_null_Max(async); + await base.Inline_collection_of_nullable_value_type_with_null_Max(); AssertSql( """ @@ -383,9 +383,9 @@ WHERE GREATEST(30, p."NullableInt", NULL) = 30 """); } - public override async Task Inline_collection_with_single_parameter_element_Contains(bool async) + public override async Task Inline_collection_with_single_parameter_element_Contains() { - await base.Inline_collection_with_single_parameter_element_Contains(async); + await base.Inline_collection_with_single_parameter_element_Contains(); AssertSql( """ @@ -397,9 +397,9 @@ public override async Task Inline_collection_with_single_parameter_element_Conta """); } - public override async Task Inline_collection_with_single_parameter_element_Count(bool async) + public override async Task Inline_collection_with_single_parameter_element_Count() { - await base.Inline_collection_with_single_parameter_element_Count(async); + await base.Inline_collection_with_single_parameter_element_Count(); AssertSql( """ @@ -414,9 +414,9 @@ SELECT count(*)::int """); } - public override async Task Inline_collection_Contains_with_EF_Parameter(bool async) + public override async Task Inline_collection_Contains_with_EF_Parameter() { - await base.Inline_collection_Contains_with_EF_Parameter(async); + await base.Inline_collection_Contains_with_EF_Parameter(); AssertSql( """ @@ -428,9 +428,9 @@ public override async Task Inline_collection_Contains_with_EF_Parameter(bool asy """); } - public override async Task Inline_collection_Count_with_column_predicate_with_EF_Parameter(bool async) + public override async Task Inline_collection_Count_with_column_predicate_with_EF_Parameter() { - await base.Inline_collection_Count_with_column_predicate_with_EF_Parameter(async); + await base.Inline_collection_Count_with_column_predicate_with_EF_Parameter(); AssertSql( """ @@ -445,9 +445,9 @@ FROM unnest(@p) AS p0(value) """); } - public override async Task Parameter_collection_Count(bool async) + public override async Task Parameter_collection_Count() { - await base.Parameter_collection_Count(async); + await base.Parameter_collection_Count(); AssertSql( """ @@ -462,9 +462,9 @@ FROM unnest(@ids) AS i(value) """); } - public override async Task Parameter_collection_of_ints_Contains_int(bool async) + public override async Task Parameter_collection_of_ints_Contains_int() { - await base.Parameter_collection_of_ints_Contains_int(async); + await base.Parameter_collection_of_ints_Contains_int(); AssertSql( """ @@ -484,9 +484,9 @@ WHERE NOT (p."Int" = ANY (@ints) AND p."Int" = ANY (@ints) IS NOT NULL) """); } - public override async Task Parameter_collection_HashSet_of_ints_Contains_int(bool async) + public override async Task Parameter_collection_HashSet_of_ints_Contains_int() { - await base.Parameter_collection_HashSet_of_ints_Contains_int(async); + await base.Parameter_collection_HashSet_of_ints_Contains_int(); AssertSql( """ @@ -506,15 +506,12 @@ WHERE NOT (p."Int" = ANY (@ints) AND p."Int" = ANY (@ints) IS NOT NULL) """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Parameter_collection_HashSet_with_value_converter_Contains(bool async) + [ConditionalFact] + public virtual async Task Parameter_collection_HashSet_with_value_converter_Contains() { HashSet enums = [MyEnum.Value1, MyEnum.Value4]; - await AssertQuery( - async, - ss => ss.Set().Where(c => enums.Contains(c.Enum))); + await AssertQuery(ss => ss.Set().Where(c => enums.Contains(c.Enum))); AssertSql( """ @@ -526,11 +523,9 @@ await AssertQuery( """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public override async Task Parameter_collection_ImmutableArray_of_ints_Contains_int(bool async) + public override async Task Parameter_collection_ImmutableArray_of_ints_Contains_int() { - await base.Parameter_collection_ImmutableArray_of_ints_Contains_int(async); + await base.Parameter_collection_ImmutableArray_of_ints_Contains_int(); AssertSql( """ @@ -550,9 +545,9 @@ WHERE NOT (p."Int" = ANY (@ints) AND p."Int" = ANY (@ints) IS NOT NULL) """); } - public override async Task Parameter_collection_of_ints_Contains_nullable_int(bool async) + public override async Task Parameter_collection_of_ints_Contains_nullable_int() { - await base.Parameter_collection_of_ints_Contains_nullable_int(async); + await base.Parameter_collection_of_ints_Contains_nullable_int(); AssertSql( """ @@ -572,9 +567,9 @@ WHERE NOT (p."NullableInt" = ANY (@ints) AND p."NullableInt" = ANY (@ints) IS NO """); } - public override async Task Parameter_collection_of_nullable_ints_Contains_int(bool async) + public override async Task Parameter_collection_of_nullable_ints_Contains_int() { - await base.Parameter_collection_of_nullable_ints_Contains_int(async); + await base.Parameter_collection_of_nullable_ints_Contains_int(); AssertSql( """ @@ -594,9 +589,9 @@ WHERE NOT (p."Int" = ANY (@nullableInts) AND p."Int" = ANY (@nullableInts) IS NO """); } - public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int(bool async) + public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int() { - await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(async); + await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(); AssertSql( """ @@ -616,9 +611,9 @@ WHERE NOT (p."NullableInt" = ANY (@nullableInts) AND p."NullableInt" = ANY (@nul """); } - public override async Task Parameter_collection_of_structs_Contains_struct(bool async) + public override async Task Parameter_collection_of_structs_Contains_struct() { - await base.Parameter_collection_of_structs_Contains_struct(async); + await base.Parameter_collection_of_structs_Contains_struct(); AssertSql( """ @@ -638,9 +633,9 @@ WHERE NOT (p."WrappedId" = ANY (@values) AND p."WrappedId" = ANY (@values) IS NO """); } - public override async Task Parameter_collection_of_strings_Contains_string(bool async) + public override async Task Parameter_collection_of_strings_Contains_string() { - await base.Parameter_collection_of_strings_Contains_string(async); + await base.Parameter_collection_of_strings_Contains_string(); AssertSql( """ @@ -660,9 +655,9 @@ WHERE NOT (p."String" = ANY (@strings) AND p."String" = ANY (@strings) IS NOT NU """); } - public override async Task Parameter_collection_of_strings_Contains_nullable_string(bool async) + public override async Task Parameter_collection_of_strings_Contains_nullable_string() { - await base.Parameter_collection_of_strings_Contains_nullable_string(async); + await base.Parameter_collection_of_strings_Contains_nullable_string(); AssertSql( """ @@ -682,9 +677,9 @@ WHERE NOT (p."NullableString" = ANY (@strings) AND p."NullableString" = ANY (@st """); } - public override async Task Parameter_collection_of_nullable_strings_Contains_string(bool async) + public override async Task Parameter_collection_of_nullable_strings_Contains_string() { - await base.Parameter_collection_of_nullable_strings_Contains_string(async); + await base.Parameter_collection_of_nullable_strings_Contains_string(); AssertSql( """ @@ -704,9 +699,9 @@ WHERE NOT (p."String" = ANY (@strings) AND p."String" = ANY (@strings) IS NOT NU """); } - public override async Task Parameter_collection_of_nullable_strings_Contains_nullable_string(bool async) + public override async Task Parameter_collection_of_nullable_strings_Contains_nullable_string() { - await base.Parameter_collection_of_nullable_strings_Contains_nullable_string(async); + await base.Parameter_collection_of_nullable_strings_Contains_nullable_string(); AssertSql( """ @@ -726,9 +721,9 @@ WHERE NOT (p."NullableString" = ANY (@strings) AND p."NullableString" = ANY (@st """); } - public override async Task Parameter_collection_of_DateTimes_Contains(bool async) + public override async Task Parameter_collection_of_DateTimes_Contains() { - await base.Parameter_collection_of_DateTimes_Contains(async); + await base.Parameter_collection_of_DateTimes_Contains(); AssertSql( """ @@ -740,9 +735,9 @@ public override async Task Parameter_collection_of_DateTimes_Contains(bool async """); } - public override async Task Parameter_collection_of_bools_Contains(bool async) + public override async Task Parameter_collection_of_bools_Contains() { - await base.Parameter_collection_of_bools_Contains(async); + await base.Parameter_collection_of_bools_Contains(); AssertSql( """ @@ -754,9 +749,9 @@ public override async Task Parameter_collection_of_bools_Contains(bool async) """); } - public override async Task Parameter_collection_of_enums_Contains(bool async) + public override async Task Parameter_collection_of_enums_Contains() { - await base.Parameter_collection_of_enums_Contains(async); + await base.Parameter_collection_of_enums_Contains(); AssertSql( """ @@ -768,9 +763,9 @@ public override async Task Parameter_collection_of_enums_Contains(bool async) """); } - public override async Task Parameter_collection_null_Contains(bool async) + public override async Task Parameter_collection_null_Contains() { - await base.Parameter_collection_null_Contains(async); + await base.Parameter_collection_null_Contains(); AssertSql( """ @@ -780,9 +775,9 @@ public override async Task Parameter_collection_null_Contains(bool async) """); } - public override async Task Parameter_collection_Contains_with_EF_Constant(bool async) + public override async Task Parameter_collection_Contains_with_EF_Constant() { - await base.Parameter_collection_Contains_with_EF_Constant(async); + await base.Parameter_collection_Contains_with_EF_Constant(); AssertSql( """ @@ -792,9 +787,9 @@ public override async Task Parameter_collection_Contains_with_EF_Constant(bool a """); } - public override async Task Parameter_collection_Where_with_EF_Constant_Where_Any(bool async) + public override async Task Parameter_collection_Where_with_EF_Constant_Where_Any() { - await base.Parameter_collection_Where_with_EF_Constant_Where_Any(async); + await base.Parameter_collection_Where_with_EF_Constant_Where_Any(); AssertSql( """ @@ -802,14 +797,14 @@ public override async Task Parameter_collection_Where_with_EF_Constant_Where_Any FROM "PrimitiveCollectionsEntity" AS p WHERE EXISTS ( SELECT 1 - FROM (VALUES (2), (999), (1000)) AS i("Value") + FROM (VALUES (2::int), (999), (1000)) AS i("Value") WHERE i."Value" > 0) """); } - public override async Task Parameter_collection_Count_with_column_predicate_with_EF_Constant(bool async) + public override async Task Parameter_collection_Count_with_column_predicate_with_EF_Constant() { - await base.Parameter_collection_Count_with_column_predicate_with_EF_Constant(async); + await base.Parameter_collection_Count_with_column_predicate_with_EF_Constant(); AssertSql( """ @@ -817,33 +812,32 @@ public override async Task Parameter_collection_Count_with_column_predicate_with FROM "PrimitiveCollectionsEntity" AS p WHERE ( SELECT count(*)::int - FROM (VALUES (2), (999), (1000)) AS i("Value") + FROM (VALUES (2::int), (999), (1000)) AS i("Value") WHERE i."Value" > p."Id") = 2 """); } // The following test does nothing since we don't override NumberOfValuesForHugeParameterCollectionTests; // the PG parameter limit is huge (ushort), so we don't need to test it. - public override async Task Parameter_collection_Count_with_huge_number_of_values(bool async) + public override async Task Parameter_collection_Count_with_huge_number_of_values() { - await base.Parameter_collection_Count_with_huge_number_of_values(async); + await base.Parameter_collection_Count_with_huge_number_of_values(); AssertSql(); } // The following test does nothing since we don't override NumberOfValuesForHugeParameterCollectionTests; // the PG parameter limit is huge (ushort), so we don't need to test it. - public override async Task Parameter_collection_of_ints_Contains_int_with_huge_number_of_values(bool async) + public override async Task Parameter_collection_of_ints_Contains_int_with_huge_number_of_values() { - await base.Parameter_collection_of_ints_Contains_int_with_huge_number_of_values(async); + await base.Parameter_collection_of_ints_Contains_int_with_huge_number_of_values(); AssertSql(); } - [ConditionalTheory] // #3012 + [ConditionalFact] // #3012 [MinimumPostgresVersion(14, 0)] // Multiranges were introduced in PostgreSQL 14 - [MemberData(nameof(IsAsyncData))] - public virtual async Task Parameter_collection_of_ranges_Contains(bool async) + public virtual async Task Parameter_collection_of_ranges_Contains() { var ranges = new NpgsqlRange[] { @@ -852,7 +846,6 @@ public virtual async Task Parameter_collection_of_ranges_Contains(bool async) }; await AssertQuery( - async, ss => ss.Set().Where(e => ranges.Contains(e.Int)), ss => ss.Set().Where(c => ranges.Any(p => p.LowerBound <= c.Int && p.UpperBound >= c.Int))); @@ -866,9 +859,9 @@ WHERE @ranges @> p."Int" """); } - public override async Task Column_collection_of_ints_Contains(bool async) + public override async Task Column_collection_of_ints_Contains() { - await base.Column_collection_of_ints_Contains(async); + await base.Column_collection_of_ints_Contains(); AssertSql( """ @@ -878,9 +871,9 @@ public override async Task Column_collection_of_ints_Contains(bool async) """); } - public override async Task Column_collection_of_nullable_ints_Contains(bool async) + public override async Task Column_collection_of_nullable_ints_Contains() { - await base.Column_collection_of_nullable_ints_Contains(async); + await base.Column_collection_of_nullable_ints_Contains(); AssertSql( """ @@ -890,9 +883,9 @@ public override async Task Column_collection_of_nullable_ints_Contains(bool asyn """); } - public override async Task Column_collection_of_nullable_ints_Contains_null(bool async) + public override async Task Column_collection_of_nullable_ints_Contains_null() { - await base.Column_collection_of_nullable_ints_Contains_null(async); + await base.Column_collection_of_nullable_ints_Contains_null(); AssertSql( """ @@ -902,9 +895,9 @@ WHERE array_position(p."NullableInts", NULL) IS NOT NULL """); } - public override async Task Column_collection_of_strings_contains_null(bool async) + public override async Task Column_collection_of_strings_contains_null() { - await base.Column_collection_of_strings_contains_null(async); + await base.Column_collection_of_strings_contains_null(); AssertSql( """ @@ -914,9 +907,9 @@ WHERE array_position(p."Strings", NULL) IS NOT NULL """); } - public override async Task Column_collection_of_nullable_strings_contains_null(bool async) + public override async Task Column_collection_of_nullable_strings_contains_null() { - await base.Column_collection_of_nullable_strings_contains_null(async); + await base.Column_collection_of_nullable_strings_contains_null(); AssertSql( """ @@ -926,9 +919,9 @@ WHERE array_position(p."NullableStrings", NULL) IS NOT NULL """); } - public override async Task Column_collection_of_bools_Contains(bool async) + public override async Task Column_collection_of_bools_Contains() { - await base.Column_collection_of_bools_Contains(async); + await base.Column_collection_of_bools_Contains(); AssertSql( """ @@ -938,9 +931,9 @@ public override async Task Column_collection_of_bools_Contains(bool async) """); } - public override async Task Column_collection_Count_method(bool async) + public override async Task Column_collection_Count_method() { - await base.Column_collection_Count_method(async); + await base.Column_collection_Count_method(); AssertSql( """ @@ -950,9 +943,9 @@ WHERE cardinality(p."Ints") = 2 """); } - public override async Task Column_collection_Length(bool async) + public override async Task Column_collection_Length() { - await base.Column_collection_Length(async); + await base.Column_collection_Length(); AssertSql( """ @@ -962,9 +955,9 @@ WHERE cardinality(p."Ints") = 2 """); } - public override async Task Column_collection_Count_with_predicate(bool async) + public override async Task Column_collection_Count_with_predicate() { - await base.Column_collection_Count_with_predicate(async); + await base.Column_collection_Count_with_predicate(); AssertSql( """ @@ -977,9 +970,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_Where_Count(bool async) + public override async Task Column_collection_Where_Count() { - await base.Column_collection_Where_Count(async); + await base.Column_collection_Where_Count(); AssertSql( """ @@ -992,9 +985,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_index_int(bool async) + public override async Task Column_collection_index_int() { - await base.Column_collection_index_int(async); + await base.Column_collection_index_int(); AssertSql( """ @@ -1004,9 +997,9 @@ public override async Task Column_collection_index_int(bool async) """); } - public override async Task Column_collection_index_string(bool async) + public override async Task Column_collection_index_string() { - await base.Column_collection_index_string(async); + await base.Column_collection_index_string(); AssertSql( """ @@ -1016,9 +1009,9 @@ public override async Task Column_collection_index_string(bool async) """); } - public override async Task Column_collection_index_datetime(bool async) + public override async Task Column_collection_index_datetime() { - await base.Column_collection_index_datetime(async); + await base.Column_collection_index_datetime(); AssertSql( """ @@ -1028,9 +1021,9 @@ public override async Task Column_collection_index_datetime(bool async) """); } - public override async Task Column_collection_index_beyond_end(bool async) + public override async Task Column_collection_index_beyond_end() { - await base.Column_collection_index_beyond_end(async); + await base.Column_collection_index_beyond_end(); AssertSql( """ @@ -1040,9 +1033,9 @@ public override async Task Column_collection_index_beyond_end(bool async) """); } - public override async Task Nullable_reference_column_collection_index_equals_nullable_column(bool async) + public override async Task Nullable_reference_column_collection_index_equals_nullable_column() { - await base.Nullable_reference_column_collection_index_equals_nullable_column(async); + await base.Nullable_reference_column_collection_index_equals_nullable_column(); AssertSql( """ @@ -1052,9 +1045,9 @@ public override async Task Nullable_reference_column_collection_index_equals_nul """); } - public override async Task Non_nullable_reference_column_collection_index_equals_nullable_column(bool async) + public override async Task Non_nullable_reference_column_collection_index_equals_nullable_column() { - await base.Non_nullable_reference_column_collection_index_equals_nullable_column(async); + await base.Non_nullable_reference_column_collection_index_equals_nullable_column(); AssertSql( """ @@ -1064,9 +1057,9 @@ WHERE cardinality(p."Strings") > 0 AND p."Strings"[2] = p."NullableString" """); } - public override async Task Inline_collection_index_Column(bool async) + public override async Task Inline_collection_index_Column() { - await base.Inline_collection_index_Column(async); + await base.Inline_collection_index_Column(); AssertSql( """ @@ -1080,9 +1073,25 @@ ORDER BY v._ord NULLS FIRST """); } - public override async Task Inline_collection_value_index_Column(bool async) + public override async Task Inline_collection_index_Column_with_EF_Constant() { - await base.Inline_collection_value_index_Column(async); + await base.Inline_collection_index_Column_with_EF_Constant(); + + AssertSql( + """ +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE ( + SELECT i."Value" + FROM (VALUES (0, 1::int), (1, 2), (2, 3)) AS i(_ord, "Value") + ORDER BY i._ord NULLS FIRST + LIMIT 1 OFFSET p."Int") = 1 +"""); + } + + public override async Task Inline_collection_value_index_Column() + { + await base.Inline_collection_value_index_Column(); AssertSql( """ @@ -1096,9 +1105,9 @@ ORDER BY v._ord NULLS FIRST """); } - public override async Task Inline_collection_List_value_index_Column(bool async) + public override async Task Inline_collection_List_value_index_Column() { - await base.Inline_collection_List_value_index_Column(async); + await base.Inline_collection_List_value_index_Column(); AssertSql( """ @@ -1112,9 +1121,9 @@ ORDER BY v._ord NULLS FIRST """); } - public override async Task Parameter_collection_index_Column_equal_Column(bool async) + public override async Task Parameter_collection_index_Column_equal_Column() { - await base.Parameter_collection_index_Column_equal_Column(async); + await base.Parameter_collection_index_Column_equal_Column(); AssertSql( """ @@ -1126,9 +1135,9 @@ public override async Task Parameter_collection_index_Column_equal_Column(bool a """); } - public override async Task Parameter_collection_index_Column_equal_constant(bool async) + public override async Task Parameter_collection_index_Column_equal_constant() { - await base.Parameter_collection_index_Column_equal_constant(async); + await base.Parameter_collection_index_Column_equal_constant(); AssertSql( """ @@ -1140,9 +1149,9 @@ public override async Task Parameter_collection_index_Column_equal_constant(bool """); } - public override async Task Column_collection_ElementAt(bool async) + public override async Task Column_collection_ElementAt() { - await base.Column_collection_ElementAt(async); + await base.Column_collection_ElementAt(); AssertSql( """ @@ -1152,9 +1161,9 @@ public override async Task Column_collection_ElementAt(bool async) """); } - public override async Task Column_collection_First(bool async) + public override async Task Column_collection_First() { - await base.Column_collection_First(async); + await base.Column_collection_First(); AssertSql( """ @@ -1167,9 +1176,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_FirstOrDefault(bool async) + public override async Task Column_collection_FirstOrDefault() { - await base.Column_collection_FirstOrDefault(async); + await base.Column_collection_FirstOrDefault(); AssertSql( """ @@ -1182,9 +1191,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_Single(bool async) + public override async Task Column_collection_Single() { - await base.Column_collection_Single(async); + await base.Column_collection_Single(); AssertSql( """ @@ -1197,9 +1206,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_SingleOrDefault(bool async) + public override async Task Column_collection_SingleOrDefault() { - await base.Column_collection_SingleOrDefault(async); + await base.Column_collection_SingleOrDefault(); AssertSql( """ @@ -1212,9 +1221,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_Skip(bool async) + public override async Task Column_collection_Skip() { - await base.Column_collection_Skip(async); + await base.Column_collection_Skip(); AssertSql( """ @@ -1224,9 +1233,9 @@ WHERE cardinality(p."Ints"[2:]) = 2 """); } - public override async Task Column_collection_Take(bool async) + public override async Task Column_collection_Take() { - await base.Column_collection_Take(async); + await base.Column_collection_Take(); AssertSql( """ @@ -1236,9 +1245,9 @@ public override async Task Column_collection_Take(bool async) """); } - public override async Task Column_collection_Skip_Take(bool async) + public override async Task Column_collection_Skip_Take() { - await base.Column_collection_Skip_Take(async); + await base.Column_collection_Skip_Take(); AssertSql( """ @@ -1248,9 +1257,9 @@ public override async Task Column_collection_Skip_Take(bool async) """); } - public override async Task Column_collection_Where_Skip(bool async) + public override async Task Column_collection_Where_Skip() { - await base.Column_collection_Where_Skip(async); + await base.Column_collection_Where_Skip(); AssertSql( """ @@ -1267,9 +1276,9 @@ OFFSET 1 """); } - public override async Task Column_collection_Where_Take(bool async) + public override async Task Column_collection_Where_Take() { - await base.Column_collection_Where_Take(async); + await base.Column_collection_Where_Take(); AssertSql( """ @@ -1286,9 +1295,9 @@ LIMIT 2 """); } - public override async Task Column_collection_Where_Skip_Take(bool async) + public override async Task Column_collection_Where_Skip_Take() { - await base.Column_collection_Where_Skip_Take(async); + await base.Column_collection_Where_Skip_Take(); AssertSql( """ @@ -1305,9 +1314,9 @@ LIMIT 2 OFFSET 1 """); } - public override async Task Column_collection_Contains_over_subquery(bool async) + public override async Task Column_collection_Contains_over_subquery() { - await base.Column_collection_Contains_over_subquery(async); + await base.Column_collection_Contains_over_subquery(); AssertSql( """ @@ -1321,9 +1330,9 @@ WHERE i.value > 1 """); } - public override async Task Column_collection_OrderByDescending_ElementAt(bool async) + public override async Task Column_collection_OrderByDescending_ElementAt() { - await base.Column_collection_OrderByDescending_ElementAt(async); + await base.Column_collection_OrderByDescending_ElementAt(); AssertSql( """ @@ -1337,9 +1346,9 @@ ORDER BY i.value DESC NULLS LAST """); } - public override async Task Column_collection_Where_ElementAt(bool async) + public override async Task Column_collection_Where_ElementAt() { - await base.Column_collection_Where_ElementAt(async); + await base.Column_collection_Where_ElementAt(); AssertSql( """ @@ -1353,9 +1362,9 @@ WHERE i.value > 1 """); } - public override async Task Column_collection_Any(bool async) + public override async Task Column_collection_Any() { - await base.Column_collection_Any(async); + await base.Column_collection_Any(); AssertSql( """ @@ -1365,9 +1374,9 @@ WHERE cardinality(p."Ints") > 0 """); } - public override async Task Column_collection_Distinct(bool async) + public override async Task Column_collection_Distinct() { - await base.Column_collection_Distinct(async); + await base.Column_collection_Distinct(); AssertSql( """ @@ -1382,9 +1391,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_SelectMany(bool async) + public override async Task Column_collection_SelectMany() { - await base.Column_collection_SelectMany(async); + await base.Column_collection_SelectMany(); AssertSql( """ @@ -1394,9 +1403,9 @@ JOIN LATERAL unnest(p."Ints") AS i(value) ON TRUE """); } - public override async Task Column_collection_SelectMany_with_filter(bool async) + public override async Task Column_collection_SelectMany_with_filter() { - await base.Column_collection_SelectMany_with_filter(async); + await base.Column_collection_SelectMany_with_filter(); AssertSql( """ @@ -1410,9 +1419,9 @@ WHERE i.value > 1 """); } - public override async Task Column_collection_SelectMany_with_Select_to_anonymous_type(bool async) + public override async Task Column_collection_SelectMany_with_Select_to_anonymous_type() { - await base.Column_collection_SelectMany_with_Select_to_anonymous_type(async); + await base.Column_collection_SelectMany_with_Select_to_anonymous_type(); AssertSql( """ @@ -1422,9 +1431,9 @@ JOIN LATERAL unnest(p."Ints") AS i(value) ON TRUE """); } - public override async Task Column_collection_projection_from_top_level(bool async) + public override async Task Column_collection_projection_from_top_level() { - await base.Column_collection_projection_from_top_level(async); + await base.Column_collection_projection_from_top_level(); AssertSql( """ @@ -1434,9 +1443,9 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Column_collection_Join_parameter_collection(bool async) + public override async Task Column_collection_Join_parameter_collection() { - await base.Column_collection_Join_parameter_collection(async); + await base.Column_collection_Join_parameter_collection(); AssertSql( """ @@ -1451,9 +1460,9 @@ INNER JOIN unnest(@ints) AS i0(value) ON i.value = i0.value) = 2 """); } - public override async Task Inline_collection_Join_ordered_column_collection(bool async) + public override async Task Inline_collection_Join_ordered_column_collection() { - await base.Inline_collection_Join_ordered_column_collection(async); + await base.Inline_collection_Join_ordered_column_collection(); AssertSql( """ @@ -1466,9 +1475,9 @@ INNER JOIN unnest(p."Ints") AS i(value) ON v."Value" = i.value) = 2 """); } - public override async Task Parameter_collection_Concat_column_collection(bool async) + public override async Task Parameter_collection_Concat_column_collection() { - await base.Parameter_collection_Concat_column_collection(async); + await base.Parameter_collection_Concat_column_collection(); AssertSql( """ @@ -1480,9 +1489,9 @@ WHERE cardinality(@ints || p."Ints") = 2 """); } - public override async Task Parameter_collection_with_type_inference_for_JsonScalarExpression(bool async) + public override async Task Parameter_collection_with_type_inference_for_JsonScalarExpression() { - await base.Parameter_collection_with_type_inference_for_JsonScalarExpression(async); + await base.Parameter_collection_with_type_inference_for_JsonScalarExpression(); AssertSql( """ @@ -1496,9 +1505,9 @@ WHEN p."Id" <> 0 THEN @values[p."Int" % 2 + 1] """); } - public override async Task Column_collection_Union_parameter_collection(bool async) + public override async Task Column_collection_Union_parameter_collection() { - await base.Column_collection_Union_parameter_collection(async); + await base.Column_collection_Union_parameter_collection(); AssertSql( """ @@ -1518,9 +1527,9 @@ FROM unnest(@ints) AS i0(value) """); } - public override async Task Column_collection_Intersect_inline_collection(bool async) + public override async Task Column_collection_Intersect_inline_collection() { - await base.Column_collection_Intersect_inline_collection(async); + await base.Column_collection_Intersect_inline_collection(); AssertSql( """ @@ -1537,15 +1546,12 @@ FROM unnest(p."Ints") AS i(value) """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Column_collection_Intersect_Parameter_collection_Any(bool async) + [ConditionalFact] + public virtual async Task Column_collection_Intersect_Parameter_collection_Any() { var ints = new[] { 11, 12 }; - await AssertQuery( - async, - ss => ss.Set().Where(c => c.Ints.Intersect(ints).Any())); + await AssertQuery(ss => ss.Set().Where(c => c.Ints.Intersect(ints).Any())); AssertSql( """ @@ -1557,9 +1563,9 @@ WHERE p."Ints" && @ints """); } - public override async Task Inline_collection_Except_column_collection(bool async) + public override async Task Inline_collection_Except_column_collection() { - await base.Inline_collection_Except_column_collection(async); + await base.Inline_collection_Except_column_collection(); AssertSql( """ @@ -1578,9 +1584,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Column_collection_Where_Union(bool async) + public override async Task Column_collection_Where_Union() { - await base.Column_collection_Where_Union(async); + await base.Column_collection_Where_Union(); AssertSql( """ @@ -1598,15 +1604,13 @@ WHERE i.value > 100 """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Parameter_collection_Concat_Column_collection_Concat_parameter(bool async) + [ConditionalFact] + public virtual async Task Parameter_collection_Concat_Column_collection_Concat_parameter() { var ints1 = new[] { 11 }; var ints2 = new[] { 12 }; await AssertQuery( - async, ss => ss.Set().Where(c => ints1.Concat(c.Ints).Concat(ints2).Count() == 4)); AssertSql( @@ -1620,16 +1624,16 @@ WHERE cardinality(@ints1 || p."Ints" || @ints2) = 4 """); } - public override async Task Column_collection_Concat_parameter_collection_equality_inline_collection(bool async) + public override async Task Column_collection_Concat_parameter_collection_equality_inline_collection() { - await base.Column_collection_Concat_parameter_collection_equality_inline_collection(async); + await base.Column_collection_Concat_parameter_collection_equality_inline_collection(); AssertSql(); } - public override async Task Column_collection_equality_parameter_collection(bool async) + public override async Task Column_collection_equality_parameter_collection() { - await base.Column_collection_equality_parameter_collection(async); + await base.Column_collection_equality_parameter_collection(); AssertSql( """ @@ -1641,9 +1645,9 @@ public override async Task Column_collection_equality_parameter_collection(bool """); } - public override async Task Column_collection_equality_inline_collection(bool async) + public override async Task Column_collection_equality_inline_collection() { - await base.Column_collection_equality_inline_collection(async); + await base.Column_collection_equality_inline_collection(); AssertSql( """ @@ -1653,12 +1657,11 @@ public override async Task Column_collection_equality_inline_collection(bool asy """); } - public override async Task Column_collection_equality_inline_collection_with_parameters(bool async) + public override async Task Column_collection_equality_inline_collection_with_parameters() { var (i, j) = (1, 10); await AssertQuery( - async, ss => ss.Set().Where(c => c.Ints == new[] { i, j }), ss => ss.Set().Where(c => c.Ints.SequenceEqual(new[] { i, j }))); @@ -1673,16 +1676,16 @@ await AssertQuery( """); } - public override async Task Column_collection_Where_equality_inline_collection(bool async) + public override async Task Column_collection_Where_equality_inline_collection() { - await base.Column_collection_Where_equality_inline_collection(async); + await base.Column_collection_Where_equality_inline_collection(); AssertSql(); } - public override async Task Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(bool async) + public override async Task Parameter_collection_in_subquery_Union_column_collection_as_compiled_query() { - await base.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async); + await base.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(); AssertSql( """ @@ -1702,9 +1705,9 @@ FROM unnest(p."Ints") AS i0(value) """); } - public override async Task Parameter_collection_in_subquery_Union_column_collection(bool async) + public override async Task Parameter_collection_in_subquery_Union_column_collection() { - await base.Parameter_collection_in_subquery_Union_column_collection(async); + await base.Parameter_collection_in_subquery_Union_column_collection(); AssertSql( """ @@ -1724,9 +1727,9 @@ FROM unnest(p."Ints") AS i(value) """); } - public override async Task Parameter_collection_in_subquery_Union_column_collection_nested(bool async) + public override async Task Parameter_collection_in_subquery_Union_column_collection_nested() { - await base.Parameter_collection_in_subquery_Union_column_collection_nested(async); + await base.Parameter_collection_in_subquery_Union_column_collection_nested(); AssertSql( """ @@ -1766,16 +1769,16 @@ public override void Parameter_collection_in_subquery_and_Convert_as_compiled_qu AssertSql(); } - public override async Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(bool async) + public override async Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query() { - await base.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async); + await base.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(); AssertSql(); } - public override async Task Parameter_collection_in_subquery_Count_as_compiled_query(bool async) + public override async Task Parameter_collection_in_subquery_Count_as_compiled_query() { - await base.Parameter_collection_in_subquery_Count_as_compiled_query(async); + await base.Parameter_collection_in_subquery_Count_as_compiled_query(); AssertSql( """ @@ -1790,9 +1793,9 @@ FROM unnest(@ints[2:]) AS i(value) """); } - public override async Task Column_collection_in_subquery_Union_parameter_collection(bool async) + public override async Task Column_collection_in_subquery_Union_parameter_collection() { - await base.Column_collection_in_subquery_Union_parameter_collection(async); + await base.Column_collection_in_subquery_Union_parameter_collection(); AssertSql( """ @@ -1812,9 +1815,9 @@ FROM unnest(@ints) AS i0(value) """); } - public override async Task Project_collection_of_ints_simple(bool async) + public override async Task Project_collection_of_ints_simple() { - await base.Project_collection_of_ints_simple(async); + await base.Project_collection_of_ints_simple(); AssertSql( """ @@ -1824,9 +1827,9 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_collection_of_ints_ordered(bool async) + public override async Task Project_collection_of_ints_ordered() { - await base.Project_collection_of_ints_ordered(async); + await base.Project_collection_of_ints_ordered(); AssertSql( """ @@ -1837,9 +1840,9 @@ LEFT JOIN LATERAL unnest(p."Ints") WITH ORDINALITY AS i(value) ON TRUE """); } - public override async Task Project_collection_of_datetimes_filtered(bool async) + public override async Task Project_collection_of_datetimes_filtered() { - await base.Project_collection_of_datetimes_filtered(async); + await base.Project_collection_of_datetimes_filtered(); AssertSql( """ @@ -1854,9 +1857,9 @@ WHERE date_part('day', d.value AT TIME ZONE 'UTC')::int <> 1 """); } - public override async Task Project_collection_of_nullable_ints_with_paging(bool async) + public override async Task Project_collection_of_nullable_ints_with_paging() { - await base.Project_collection_of_nullable_ints_with_paging(async); + await base.Project_collection_of_nullable_ints_with_paging(); AssertSql( """ @@ -1867,9 +1870,9 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_collection_of_nullable_ints_with_paging2(bool async) + public override async Task Project_collection_of_nullable_ints_with_paging2() { - await base.Project_collection_of_nullable_ints_with_paging2(async); + await base.Project_collection_of_nullable_ints_with_paging2(); AssertSql( """ @@ -1885,9 +1888,9 @@ OFFSET 1 """); } - public override async Task Project_collection_of_nullable_ints_with_paging3(bool async) + public override async Task Project_collection_of_nullable_ints_with_paging3() { - await base.Project_collection_of_nullable_ints_with_paging3(async); + await base.Project_collection_of_nullable_ints_with_paging3(); AssertSql( """ @@ -1898,9 +1901,9 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_collection_of_ints_with_distinct(bool async) + public override async Task Project_collection_of_ints_with_distinct() { - await base.Project_collection_of_ints_with_distinct(async); + await base.Project_collection_of_ints_with_distinct(); AssertSql( """ @@ -1914,16 +1917,16 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_collection_of_nullable_ints_with_distinct(bool async) + public override async Task Project_collection_of_nullable_ints_with_distinct() { - await base.Project_collection_of_nullable_ints_with_distinct(async); + await base.Project_collection_of_nullable_ints_with_distinct(); AssertSql(); } - public override async Task Project_collection_of_ints_with_ToList_and_FirstOrDefault(bool async) + public override async Task Project_collection_of_ints_with_ToList_and_FirstOrDefault() { - await base.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async); + await base.Project_collection_of_ints_with_ToList_and_FirstOrDefault(); AssertSql( """ @@ -1939,9 +1942,9 @@ LEFT JOIN LATERAL unnest(p0."Ints") WITH ORDINALITY AS i(value) ON TRUE """); } - public override async Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls(bool async) + public override async Task Project_empty_collection_of_nullables_and_collection_only_containing_nulls() { - await base.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async); + await base.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(); AssertSql( """ @@ -1961,11 +1964,10 @@ WHERE n0.value IS NULL """); } - public override async Task Project_multiple_collections(bool async) + public override async Task Project_multiple_collections() { // Base implementation currently uses an Unspecified DateTime in the query, but we require a Utc one. await AssertQuery( - async, ss => ss.Set().OrderBy(x => x.Id).Select( x => new { @@ -2003,9 +2005,9 @@ FROM unnest(p."DateTimes") WITH ORDINALITY AS d0(value) """); } - public override async Task Project_primitive_collections_element(bool async) + public override async Task Project_primitive_collections_element() { - await base.Project_primitive_collections_element(async); + await base.Project_primitive_collections_element(); AssertSql( """ @@ -2016,9 +2018,9 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_inline_collection(bool async) + public override async Task Project_inline_collection() { - await base.Project_inline_collection(async); + await base.Project_inline_collection(); AssertSql( """ @@ -2027,9 +2029,9 @@ public override async Task Project_inline_collection(bool async) """); } - public override async Task Project_inline_collection_with_Union(bool async) + public override async Task Project_inline_collection_with_Union() { - await base.Project_inline_collection_with_Union(async); + await base.Project_inline_collection_with_Union(); AssertSql( """ @@ -2046,16 +2048,16 @@ ORDER BY p."Id" NULLS FIRST """); } - public override async Task Project_inline_collection_with_Concat(bool async) + public override async Task Project_inline_collection_with_Concat() { - await base.Project_inline_collection_with_Concat(async); + await base.Project_inline_collection_with_Concat(); AssertSql(); } - public override async Task Nested_contains_with_Lists_and_no_inferred_type_mapping(bool async) + public override async Task Nested_contains_with_Lists_and_no_inferred_type_mapping() { - await base.Nested_contains_with_Lists_and_no_inferred_type_mapping(async); + await base.Nested_contains_with_Lists_and_no_inferred_type_mapping(); AssertSql( """ @@ -2071,9 +2073,9 @@ WHERE CASE """); } - public override async Task Nested_contains_with_arrays_and_no_inferred_type_mapping(bool async) + public override async Task Nested_contains_with_arrays_and_no_inferred_type_mapping() { - await base.Nested_contains_with_arrays_and_no_inferred_type_mapping(async); + await base.Nested_contains_with_arrays_and_no_inferred_type_mapping(); AssertSql( """ @@ -2089,9 +2091,9 @@ WHERE CASE """); } - public override async Task Values_of_enum_casted_to_underlying_value(bool async) + public override async Task Values_of_enum_casted_to_underlying_value() { - await base.Values_of_enum_casted_to_underlying_value(async); + await base.Values_of_enum_casted_to_underlying_value(); AssertSql( """ @@ -2104,12 +2106,10 @@ SELECT count(*)::int """); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Array_remove(bool async) + [ConditionalFact] + public virtual async Task Array_remove() { await AssertQuery( - async, // ReSharper disable once ReplaceWithSingleCallToCount ss => ss.Set().Where(e => e.Ints.Where(i => i != 1).Count() == 1)); @@ -2121,9 +2121,9 @@ WHERE cardinality(array_remove(p."Ints", 1)) = 1 """); } - public override async Task Parameter_collection_of_structs_Contains_nullable_struct(bool async) + public override async Task Parameter_collection_of_structs_Contains_nullable_struct() { - await base.Parameter_collection_of_structs_Contains_nullable_struct(async); + await base.Parameter_collection_of_structs_Contains_nullable_struct(); AssertSql( """ @@ -2143,13 +2143,13 @@ WHERE NOT (p."NullableWrappedId" = ANY (@values) AND p."NullableWrappedId" = ANY """); } - public override Task Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(bool async) + public override Task Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer() => Assert.ThrowsAnyAsync( - () => base.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(async)); + () => base.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer()); - public override async Task Parameter_collection_of_nullable_structs_Contains_struct(bool async) + public override async Task Parameter_collection_of_nullable_structs_Contains_struct() { - await base.Parameter_collection_of_nullable_structs_Contains_struct(async); + await base.Parameter_collection_of_nullable_structs_Contains_struct(); AssertSql( """ @@ -2169,9 +2169,9 @@ WHERE NOT (p."WrappedId" = ANY (@values) AND p."WrappedId" = ANY (@values) IS NO """); } - public override async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct(bool async) + public override async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct() { - await base.Parameter_collection_of_nullable_structs_Contains_nullable_struct(async); + await base.Parameter_collection_of_nullable_structs_Contains_nullable_struct(); AssertSql( """ @@ -2191,9 +2191,9 @@ WHERE NOT (p."NullableWrappedId" = ANY (@values) AND p."NullableWrappedId" = ANY """); } - public override Task Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(bool async) + public override Task Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer() => Assert.ThrowsAnyAsync( - () => base.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(async)); + () => base.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer()); [ConditionalFact] public virtual void Check_all_tests_overridden() diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs new file mode 100644 index 0000000000..76254b3a53 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs @@ -0,0 +1,218 @@ +namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexJson; + +public class ComplexJsonCollectionNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb + )) WITH ORDINALITY AS r0) = 2 +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("Int" integer)) WITH ORDINALITY AS r0 + WHERE r0."Int" <> 8) = 2 +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT r0."Int" + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer + )) WITH ORDINALITY AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 OFFSET 0) = 8 +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ( + SELECT DISTINCT r0."Id", r0."Int", r0."Name", r0."String", r0."NestedCollection" AS c, r0."OptionalNested" AS c0, r0."RequiredNested" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb + )) WITH ORDINALITY AS r0 + ) AS r1) = 2 +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ( + SELECT DISTINCT r0."NestedCollection" AS c + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS r0 + ) AS r1) = 2 +"""); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> '{0,Int}' AS integer)) = 8 +"""); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql( + """ +@i='?' (DbType = Int32) + +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 +"""); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 +"""); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> '{9999,Int}' AS integer)) = 8 +"""); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE 16 IN ( + SELECT COALESCE(sum(r0."Int"), 0)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Int" integer, + "String" text + )) WITH ORDINALITY AS r0 + GROUP BY r0."String" +) +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT max(n."Int") + FROM ROWS FROM (jsonb_to_recordset(r0."NestedCollection") AS ("Int" integer)) WITH ORDINALITY AS n)), 0)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS r0) +FROM "RootEntity" AS r +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..e8ce89b515 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs @@ -0,0 +1,52 @@ +// 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.Relationships.ComplexJson; + +public class ComplexJsonMiscellaneousNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RequiredRelated" ->> 'Int' AS integer)) = 8 +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."OptionalRelated" ->> 'Int' AS integer)) = 8 +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RequiredRelated" #>> '{RequiredNested,Int}' AS integer)) = 8 +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonNpgsqlFixture.cs new file mode 100644 index 0000000000..702b0b3376 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonNpgsqlFixture.cs @@ -0,0 +1,10 @@ +// 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.Relationships.ComplexJson; + +public class ComplexJsonNpgsqlFixture : ComplexJsonRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => NpgsqlTestStoreFactory.Instance; +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs new file mode 100644 index 0000000000..e11a7ab251 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs @@ -0,0 +1,315 @@ +// 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.Relationships.ComplexJson; + +public class ComplexJsonProjectionNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +"""); + } + + #region Simple properties + + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" ->> 'String' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" ->> 'String' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + + #endregion Simple properties + + #region Non-collection + + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" -> 'RequiredNested' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" -> 'OptionalNested' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" -> 'RequiredNested' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" -> 'OptionalNested' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + + AssertSql( + """ +SELECT r0."RequiredRelated" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +"""); + } + + #endregion Non-collection + + #region Collection + + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_related_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RelatedCollection" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" -> 'NestedCollection' +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" -> 'NestedCollection' +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_related_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT r0."Id", r0."Int", r0."Name", r0."String", r0."NestedCollection", r0."OptionalNested", r0."RequiredNested" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb +)) WITH ORDINALITY AS r0 ON TRUE +"""); + } + + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT n."Id", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text +)) WITH ORDINALITY AS n ON TRUE +"""); + } + + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT n."Id", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalRelated" -> 'NestedCollection') AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text +)) WITH ORDINALITY AS n ON TRUE +"""); + } + + #endregion Collection + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT r1.c +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."RequiredRelated" -> 'RequiredNested' AS c + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT r1.c +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."OptionalRelated" -> 'RequiredNested' AS c + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); + } + + #endregion Subquery + + #region Value types + + public override async Task Select_root_with_value_types(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_with_value_types(queryTrackingBehavior); + + AssertSql( + """ +SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +FROM "ValueRootEntity" AS v +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs new file mode 100644 index 0000000000..9f321bf9e9 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs @@ -0,0 +1,99 @@ +// 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.Relationships.ComplexJson; + +public class ComplexJsonSetOperationsNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task On_related() + { + await base.On_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("Int" integer)) WITH ORDINALITY AS r0 + WHERE r0."Int" = 8 + UNION ALL + SELECT 1 + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("String" text)) WITH ORDINALITY AS r1 + WHERE r1."String" = 'foo' + ) AS u) = 4 +"""); + } + + public override async Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.On_related_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + { + await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT COALESCE(sum(n."Int"), 0)::int + FROM ROWS FROM (jsonb_to_recordset(u."NestedCollection") AS ("Int" integer)) WITH ORDINALITY AS n)), 0)::int + FROM ( + SELECT r0."NestedCollection" AS "NestedCollection" + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Int" integer, + "NestedCollection" jsonb + )) WITH ORDINALITY AS r0 + WHERE r0."Int" = 8 + UNION ALL + SELECT r1."NestedCollection" AS "NestedCollection" + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "String" text, + "NestedCollection" jsonb + )) WITH ORDINALITY AS r1 + WHERE r1."String" = 'foo' + ) AS u) +FROM "RootEntity" AS r +"""); + } + + public override async Task On_nested() + { + await base.On_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ("Int" integer)) WITH ORDINALITY AS n + WHERE n."Int" = 8 + UNION ALL + SELECT 1 + FROM ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ("String" text)) WITH ORDINALITY AS n0 + WHERE n0."String" = 'foo' + ) AS u) = 4 +"""); + } + + public override async Task Over_different_collection_properties() + { + await base.Over_different_collection_properties(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..86a5020169 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,152 @@ +// 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.Relationships.ComplexJson; + +public class ComplexJsonStructuralEqualityNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + // The SQL Server json type cannot be compared ("The JSON data type cannot be compared or sorted, except when using the + // IS NULL operator"). + // So we find comparisons that involve the json type, and apply a conversion to string (nvarchar(max)) to both sides. + + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated") = (r."OptionalRelated") +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'RequiredNested') = (r."OptionalRelated" -> 'RequiredNested') +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated") <> (r."OptionalRelated") OR (r."OptionalRelated") IS NULL +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."OptionalRelated") IS NULL +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."OptionalRelated") IS NULL +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" ->> 'OptionalNested') IS NULL +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'RequiredNested') = '{"Id":1000,"Int":8,"Name":"Root1_RequiredRelated_RequiredNested","String":"foo"}' +"""); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql( + """ +@entity_equality_nested='?' (DbType = Object) + +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'RequiredNested') = @entity_equality_nested +"""); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'NestedCollection') = (r."OptionalRelated" -> 'NestedCollection') +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'NestedCollection') = '[{"Id":1002,"Int":8,"Name":"Root1_RequiredRelated_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Name":"Root1_RequiredRelated_NestedCollection_2","String":"foo"}]' +"""); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql( + """ +@entity_equality_nestedCollection='?' (DbType = Object) + +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" -> 'NestedCollection') = @entity_equality_nestedCollection +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..5571c3ad0a --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs @@ -0,0 +1,50 @@ +// 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.Relationships.ComplexTableSplitting; + +public class ComplexTableSplittingMiscellaneousNpgsqlTest( + ComplexTableSplittingNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_Int" = 8 +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."OptionalRelated_Int" = 8 +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_RequiredNested_Int" = 8 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingNpgsqlFixture.cs index 5cd83a7a56..216962a66e 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingNpgsqlFixture.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingNpgsqlFixture.cs @@ -1,10 +1,10 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexTableSplitting; +// 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.Relationships.ComplexTableSplitting; public class ComplexTableSplittingNpgsqlFixture : ComplexTableSplittingRelationalFixtureBase, ITestSqlLoggerFactory { protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs index 2cb79d86f5..2e1f73f051 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs @@ -1,241 +1,249 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexTableSplitting; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class ComplexTableSplittingProjectionNpgsqlTest - : ComplexTableSplittingProjectionRelationalTestBase -{ - public ComplexTableSplittingProjectionNpgsqlTest(ComplexTableSplittingNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } +namespace Microsoft.EntityFrameworkCore.Query.Relationships.ComplexTableSplitting; - public override async Task Select_root(bool async, QueryTrackingBehavior queryTrackingBehavior) +public class ComplexTableSplittingProjectionNpgsqlTest( + ComplexTableSplittingNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root(async, queryTrackingBehavior); + await base.Select_related_collection(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_trunk_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_optional(async, queryTrackingBehavior); + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", t."RequiredReferenceBranch_Name", t."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_trunk_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_required(async, queryTrackingBehavior); + await base.Select_root(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", t."RequiredReferenceBranch_Name", t."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r """); } - public override async Task Select_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_collection(async, queryTrackingBehavior); + await base.Select_property_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT [r].[Id], [t].[Id], [t].[CollectionRootId], [t].[Name], [t].[OptionalReferenceBranchId], [t].[RequiredReferenceBranchId], [t].[RequiredReferenceBranch_Name], [t].[RequiredReferenceBranch_RequiredReferenceLeaf_Name] -FROM [RootEntities] AS [r] -LEFT JOIN [TrunkEntities] AS [t] ON [r].[Id] = [t].[CollectionRootId] -ORDER BY [r].[Id] +SELECT r."RequiredRelated_String" +FROM "RootEntity" AS r """); } - public override async Task Select_branch_required_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_required(async, queryTrackingBehavior); + await base.Select_property_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT t."RequiredReferenceBranch_Name", t."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r."OptionalRelated_String" +FROM "RootEntity" AS r """); } - public override async Task Select_branch_required_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_optional(async, queryTrackingBehavior); - - AssertSql(); - } - - public override async Task Select_branch_optional_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_required(async, queryTrackingBehavior); + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); - AssertSql(); - } - - public override async Task Select_branch_optional_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); - - AssertSql(); - } - - public override async Task Select_branch_required_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_collection(async, queryTrackingBehavior); - - AssertSql(); + AssertSql( + """ +SELECT r."OptionalRelated_Int" +FROM "RootEntity" AS r +"""); } - public override async Task Select_branch_optional_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_collection(async, queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."OptionalRelated_Int" +FROM "RootEntity" AS r +"""); } - #region Multiple - - public override async Task Select_root_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root_duplicated(async, queryTrackingBehavior); + await base.Select_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r +SELECT r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r """); } - public override async Task Select_trunk_and_branch_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_branch_duplicated(async, queryTrackingBehavior); + await base.Select_optional_related(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r +"""); } - public override async Task Select_trunk_and_trunk_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_trunk_duplicated(async, queryTrackingBehavior); + await base.Select_required_nested_on_required_related(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +"""); } - public override async Task Select_leaf_trunk_root(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT t."RequiredReferenceBranch_RequiredReferenceLeaf_Name", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", t."RequiredReferenceBranch_Name", r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" +SELECT r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String" +FROM "RootEntity" AS r """); } - public override async Task Select_multiple_branch_leaf(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_multiple_branch_leaf(async, queryTrackingBehavior); + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r +"""); } - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String" +FROM "RootEntity" AS r +"""); } - public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r0."RequiredRelated_Id", r0."RequiredRelated_Int", r0."RequiredRelated_Name", r0."RequiredRelated_String", r0."RequiredRelated_OptionalNested_Id", r0."RequiredRelated_OptionalNested_Int", r0."RequiredRelated_OptionalNested_Name", r0."RequiredRelated_OptionalNested_String", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +"""); } - public override async Task Select_everything(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_everything(async, queryTrackingBehavior); + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", t."RequiredReferenceBranch_Name", t."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."Id" = t."Id" +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async, queryTrackingBehavior); + await base.SelectMany_related_collection(queryTrackingBehavior); AssertSql(); } - public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); AssertSql(); } - public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); AssertSql(); } - #endregion Subquery - - #region SelectMany - - public override async Task SelectMany_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_trunk_collection(async, queryTrackingBehavior); + await base.Select_root_duplicated(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +"""); } - public override async Task SelectMany_required_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_required_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r1."RequiredRelated_RequiredNested_Id", r1."RequiredRelated_RequiredNested_Int", r1."RequiredRelated_RequiredNested_Name", r1."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); } - public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_optional_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); - AssertSql(); + AssertSql( + """ +SELECT r1."OptionalRelated_RequiredNested_Id", r1."OptionalRelated_RequiredNested_Int", r1."OptionalRelated_RequiredNested_Name", r1."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."OptionalRelated_RequiredNested_Id", r0."OptionalRelated_RequiredNested_Int", r0."OptionalRelated_RequiredNested_Name", r0."OptionalRelated_RequiredNested_String" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); } - #endregion SelectMany - [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..8375649120 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,136 @@ +// 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.Relationships.ComplexTableSplitting; + +public class ComplexTableSplittingStructuralEqualityNpgsqlTest( + ComplexTableSplittingNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_Id" = r."OptionalRelated_Id" AND r."RequiredRelated_Int" = r."OptionalRelated_Int" AND r."RequiredRelated_Name" = r."OptionalRelated_Name" AND r."RequiredRelated_String" = r."OptionalRelated_String" AND (r."RequiredRelated_OptionalNested_Id" = r."RequiredRelated_OptionalNested_Id" OR r."RequiredRelated_OptionalNested_Id" IS NULL) AND (r."RequiredRelated_OptionalNested_Int" = r."RequiredRelated_OptionalNested_Int" OR r."RequiredRelated_OptionalNested_Int" IS NULL) AND (r."RequiredRelated_OptionalNested_Name" = r."RequiredRelated_OptionalNested_Name" OR r."RequiredRelated_OptionalNested_Name" IS NULL) AND (r."RequiredRelated_OptionalNested_String" = r."RequiredRelated_OptionalNested_String" OR r."RequiredRelated_OptionalNested_String" IS NULL) AND r."RequiredRelated_RequiredNested_Id" = r."RequiredRelated_RequiredNested_Id" AND r."RequiredRelated_RequiredNested_Int" = r."RequiredRelated_RequiredNested_Int" AND r."RequiredRelated_RequiredNested_Name" = r."RequiredRelated_RequiredNested_Name" AND r."RequiredRelated_RequiredNested_String" = r."RequiredRelated_RequiredNested_String" +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_RequiredNested_Id" = r."OptionalRelated_RequiredNested_Id" AND r."RequiredRelated_RequiredNested_Int" = r."OptionalRelated_RequiredNested_Int" AND r."RequiredRelated_RequiredNested_Name" = r."OptionalRelated_RequiredNested_Name" AND r."RequiredRelated_RequiredNested_String" = r."OptionalRelated_RequiredNested_String" +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_Id" <> r."OptionalRelated_Id" OR r."OptionalRelated_Id" IS NULL OR r."RequiredRelated_Int" <> r."OptionalRelated_Int" OR r."OptionalRelated_Int" IS NULL OR r."RequiredRelated_Name" <> r."OptionalRelated_Name" OR r."OptionalRelated_Name" IS NULL OR r."RequiredRelated_String" <> r."OptionalRelated_String" OR r."OptionalRelated_String" IS NULL OR ((r."RequiredRelated_OptionalNested_Id" <> r."RequiredRelated_OptionalNested_Id" OR r."RequiredRelated_OptionalNested_Id" IS NULL) AND r."RequiredRelated_OptionalNested_Id" IS NOT NULL) OR ((r."RequiredRelated_OptionalNested_Int" <> r."RequiredRelated_OptionalNested_Int" OR r."RequiredRelated_OptionalNested_Int" IS NULL) AND r."RequiredRelated_OptionalNested_Int" IS NOT NULL) OR ((r."RequiredRelated_OptionalNested_Name" <> r."RequiredRelated_OptionalNested_Name" OR r."RequiredRelated_OptionalNested_Name" IS NULL) AND r."RequiredRelated_OptionalNested_Name" IS NOT NULL) OR ((r."RequiredRelated_OptionalNested_String" <> r."RequiredRelated_OptionalNested_String" OR r."RequiredRelated_OptionalNested_String" IS NULL) AND r."RequiredRelated_OptionalNested_String" IS NOT NULL) OR r."RequiredRelated_RequiredNested_Id" <> r."RequiredRelated_RequiredNested_Id" OR r."RequiredRelated_RequiredNested_Id" IS NULL OR r."RequiredRelated_RequiredNested_Int" <> r."RequiredRelated_RequiredNested_Int" OR r."RequiredRelated_RequiredNested_Int" IS NULL OR r."RequiredRelated_RequiredNested_Name" <> r."RequiredRelated_RequiredNested_Name" OR r."RequiredRelated_RequiredNested_Name" IS NULL OR r."RequiredRelated_RequiredNested_String" <> r."RequiredRelated_RequiredNested_String" OR r."RequiredRelated_RequiredNested_String" IS NULL +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."OptionalRelated_Id" IS NULL +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."OptionalRelated_Id" IS NULL AND r."OptionalRelated_Int" IS NULL AND r."OptionalRelated_Name" IS NULL AND r."OptionalRelated_String" IS NULL AND r."OptionalRelated_OptionalNested_Id" IS NULL AND r."OptionalRelated_OptionalNested_Int" IS NULL AND r."OptionalRelated_OptionalNested_Name" IS NULL AND r."OptionalRelated_OptionalNested_String" IS NULL AND r."OptionalRelated_RequiredNested_Id" IS NULL AND r."OptionalRelated_RequiredNested_Int" IS NULL AND r."OptionalRelated_RequiredNested_Name" IS NULL AND r."OptionalRelated_RequiredNested_String" IS NULL +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_OptionalNested_Id" IS NULL +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_RequiredNested_Id" = 1000 AND r."RequiredRelated_RequiredNested_Int" = 8 AND r."RequiredRelated_RequiredNested_Name" = 'Root1_RequiredRelated_RequiredNested' AND r."RequiredRelated_RequiredNested_String" = 'foo' +"""); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql( + """ +@entity_equality_nested_Id='?' (DbType = Int32) +@entity_equality_nested_Int='?' (DbType = Int32) +@entity_equality_nested_Name='?' +@entity_equality_nested_String='?' + +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +WHERE r."RequiredRelated_RequiredNested_Id" = @entity_equality_nested_Id AND r."RequiredRelated_RequiredNested_Int" = @entity_equality_nested_Int AND r."RequiredRelated_RequiredNested_Name" = @entity_equality_nested_Name AND r."RequiredRelated_RequiredNested_String" = @entity_equality_nested_String +"""); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql(); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsNpgsqlFixture.cs deleted file mode 100644 index f262ca362b..0000000000 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsNpgsqlFixture.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.JsonOwnedNavigations; - -public class JsonOwnedNavigationsNpgsqlFixture : JsonOwnedNavigationsRelationalFixtureBase, ITestSqlLoggerFactory -{ - protected override ITestStoreFactory TestStoreFactory - => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; -} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsProjectionNpgsqlTest.cs deleted file mode 100644 index 390c95c632..0000000000 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedNavigationsProjectionNpgsqlTest.cs +++ /dev/null @@ -1,457 +0,0 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.JsonOwnedNavigations; - -public class JsonOwnedNavigationsProjectionNpgsqlTest - : JsonOwnedNavigationsProjectionRelationalTestBase -{ - public JsonOwnedNavigationsProjectionNpgsqlTest(JsonOwnedNavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } - - public override async Task Select_root(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root(async, queryTrackingBehavior); - - AssertSql( - """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - - public override async Task Select_trunk_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_optional(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."OptionalReferenceTrunk", r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_trunk_required(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_required(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk", r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_collection(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."CollectionTrunk", r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_required_required(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_required(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'RequiredReferenceBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_required_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_optional(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'OptionalReferenceBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_optional_required(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_optional_required(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'RequiredReferenceBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_optional_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'OptionalReferenceBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_required_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_collection(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'CollectionBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_branch_optional_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_optional_collection(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" -> 'CollectionBranch', r."Id" -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_multiple_branch_leaf(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_multiple_branch_leaf(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", r."RequiredReferenceTrunk" -> 'RequiredReferenceBranch', r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,OptionalReferenceLeaf}', r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,CollectionLeaf}', r."RequiredReferenceTrunk" -> 'CollectionBranch', r."RequiredReferenceTrunk" #>> '{RequiredReferenceBranch,OptionalReferenceLeaf,Name}' -FROM "RootEntities" AS r -"""); - } - } - - #region Multiple - - public override async Task Select_root_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_root_duplicated(async, queryTrackingBehavior); - - AssertSql( - """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - - public override async Task Select_trunk_and_branch_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_and_branch_duplicated(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."OptionalReferenceTrunk", r."Id", r."OptionalReferenceTrunk" -> 'RequiredReferenceBranch', r."OptionalReferenceTrunk", r."OptionalReferenceTrunk" -> 'RequiredReferenceBranch' -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_trunk_and_trunk_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_and_trunk_duplicated(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk", r."Id", r."RequiredReferenceTrunk" #> '{OptionalReferenceBranch,RequiredReferenceLeaf}', r."RequiredReferenceTrunk", r."RequiredReferenceTrunk" #> '{OptionalReferenceBranch,RequiredReferenceLeaf}' -FROM "RootEntities" AS r -ORDER BY r."Id" NULLS FIRST -"""); - } - } - - public override async Task Select_leaf_trunk_root(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - #endregion Subquery - - #region SelectMany - - public override async Task SelectMany_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task SelectMany_required_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."RequiredReferenceTrunk" #> '{RequiredReferenceBranch,RequiredReferenceLeaf}', r."Id", r."RequiredReferenceTrunk", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r."CollectionTrunk", r."OptionalReferenceTrunk", r."RequiredReferenceTrunk" -FROM "RootEntities" AS r -"""); - } - } - - #endregion SelectMany - - private async Task AssertCantTrackJson(QueryTrackingBehavior queryTrackingBehavior, Func test) - { - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - var message = (await Assert.ThrowsAsync(test)).Message; - - Assert.Equal(CoreStrings.OwnedEntitiesCannotBeTrackedWithoutTheirOwner, message); - AssertSql(); - - return; - } - - await test(); - } - - [ConditionalFact] - public virtual void Check_all_tests_overridden() - => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); -} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedTypeNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedTypeNpgsqlFixture.cs deleted file mode 100644 index 16fd57f851..0000000000 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/JsonOwnedNavigations/JsonOwnedTypeNpgsqlFixture.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore.TestModels.RelationshipsModel; - -namespace Microsoft.EntityFrameworkCore.Query.Relationships.JsonOwnedNavigations; - -public class JsonOwnedTypeNpgsqlFixture : JsonOwnedNavigationsRelationalFixtureBase, ITestSqlLoggerFactory -{ - protected override string StoreName => "JsonTypeRelationshipsQueryTest"; - - protected override ITestStoreFactory TestStoreFactory - => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; - - protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - { - base.OnModelCreating(modelBuilder, context); - - modelBuilder.Entity().OwnsOne(x => x.RequiredReferenceTrunk).HasColumnType("json"); - modelBuilder.Entity().OwnsOne(x => x.OptionalReferenceTrunk).HasColumnType("json"); - modelBuilder.Entity().OwnsMany(x => x.CollectionTrunk).HasColumnType("json"); - } -} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsCollectionNpgsqlTest.cs new file mode 100644 index 0000000000..d709986943 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsCollectionNpgsqlTest.cs @@ -0,0 +1,269 @@ +// 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.Relationships.Navigations; + +public class NavigationsCollectionNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n."Id", n0."Id", r2."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r2 ON r."RequiredRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n1 ON r2."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r2."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r3 + LEFT JOIN "NestedType" AS n4 ON r3."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r3."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r3."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId") = 2 +ORDER BY r."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n."Id", n0."Id", r2."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r2 ON r."RequiredRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n1 ON r2."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r2."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r3 + LEFT JOIN "NestedType" AS n4 ON r3."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r3."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r3."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" AND r0."Int" <> 8) = 2 +ORDER BY r."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n."Id", n0."Id", r2."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r2 ON r."RequiredRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n1 ON r2."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r2."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r3 + LEFT JOIN "NestedType" AS n4 ON r3."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r3."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r3."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +WHERE ( + SELECT r0."Int" + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 OFFSET 0) = 8 +ORDER BY r."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n."Id", n0."Id", r3."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r2 ON r."OptionalRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n ON r2."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r2."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r3 ON r."RequiredRelatedId" = r3."Id" +LEFT JOIN "NestedType" AS n1 ON r3."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r3."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r2."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r4."Id", r4."CollectionRootId", r4."Int", r4."Name", r4."OptionalNestedId", r4."RequiredNestedId", r4."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r4 + LEFT JOIN "NestedType" AS n4 ON r4."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r4."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r4."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r3."Id" = n7."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT DISTINCT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String" + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" + ) AS r1) = 2 +ORDER BY r."Id" NULLS FIRST, r2."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r3."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n."Id" AS "Id0", n0."Id" AS "Id1", n1."Id" AS "Id2", n1."CollectionRelatedId", n1."Int" AS "Int0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionRelatedId" AS "CollectionRelatedId0", n."Int" AS "Int1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionRelatedId" AS "CollectionRelatedId1", n0."Int" AS "Int2", n0."Name" AS "Name2", n0."String" AS "String2" + FROM ( + SELECT DISTINCT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String" + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" + ) AS r1 + LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" + INNER JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" + LEFT JOIN "NestedType" AS n1 ON r1."Id" = n1."CollectionRelatedId" +) AS s ON TRUE +ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST +"""); + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql(); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql(); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql(); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql(); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n."Id", n0."Id", r2."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r2 ON r."RequiredRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n1 ON r2."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r2."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r3 + LEFT JOIN "NestedType" AS n4 ON r3."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r3."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r3."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +WHERE 16 IN ( + SELECT COALESCE(sum(r0."Int"), 0)::int + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" + GROUP BY r0."String" +) +ORDER BY r."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT max(n."Int") + FROM "NestedType" AS n + WHERE r0."Id" = n."CollectionRelatedId")), 0)::int + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId") +FROM "RootEntity" AS r +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsIncludeNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsIncludeNpgsqlTest.cs index d33687c480..4140557862 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsIncludeNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsIncludeNpgsqlTest.cs @@ -1,142 +1,255 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class NavigationsIncludeNpgsqlTest - : NavigationsIncludeRelationalTestBase -{ - public NavigationsIncludeNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } +namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; - public override async Task Include_trunk_required(bool async) +public class NavigationsIncludeNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsIncludeRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Include_required(bool async) { - await base.Include_trunk_required(async); + await base.Include_required(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_trunk_optional(bool async) + public override async Task Include_optional(bool async) { - await base.Include_trunk_optional(async); + await base.Include_optional(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_trunk_collection(bool async) + public override async Task Include_collection(bool async) { - await base.Include_trunk_collection(async); + await base.Include_collection(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."Id" = t."CollectionRootId" -ORDER BY r."Id" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_trunk_required_optional_and_collection(bool async) + public override async Task Include_required_optional_and_collection(bool async) { - await base.Include_trunk_required_optional_and_collection(async); + await base.Include_required_optional_and_collection(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", t0."Id", t0."CollectionRootId", t0."Name", t0."OptionalReferenceBranchId", t0."RequiredReferenceBranchId", t1."Id", t1."CollectionRootId", t1."Name", t1."OptionalReferenceBranchId", t1."RequiredReferenceBranchId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "TrunkEntities" AS t0 ON r."OptionalReferenceTrunkId" = t0."Id" -LEFT JOIN "TrunkEntities" AS t1 ON r."Id" = t1."CollectionRootId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST, t0."Id" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_branch_required_required(bool async) + public override async Task Include_nested(bool async) { - await base.Include_branch_required_required(async); + await base.Include_nested(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_branch_required_collection(bool async) + public override async Task Include_nested_optional(bool async) { - await base.Include_branch_required_collection(async); + await base.Include_nested_optional(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_branch_optional_optional(bool async) + public override async Task Include_nested_collection(bool async) { - await base.Include_branch_optional_optional(async); + await base.Include_nested_collection(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."OptionalReferenceBranchId" = b."Id" +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_branch_optional_collection(bool async) + public override async Task Include_nested_collection_on_optional(bool async) { - await base.Include_branch_optional_collection(async); + await base.Include_nested_collection_on_optional(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Include_branch_collection_collection(bool async) + public override async Task Include_nested_collection_on_collection(bool async) { - await base.Include_branch_collection_collection(async); + await base.Include_nested_collection_on_collection(async); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", s."Id", s."CollectionRootId", s."Name", s."OptionalReferenceBranchId", s."RequiredReferenceBranchId", s."Id0", s."CollectionTrunkId", s."Name0", s."OptionalReferenceLeafId", s."RequiredReferenceLeafId" -FROM "RootEntities" AS r +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" LEFT JOIN ( - SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id" AS "Id0", b."CollectionTrunkId", b."Name" AS "Name0", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" - FROM "TrunkEntities" AS t - LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" ) AS s ON r."Id" = s."CollectionRootId" -ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..f283d2333b --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsMiscellaneousNpgsqlTest.cs @@ -0,0 +1,102 @@ +// 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.Relationships.Navigations; + +public class NavigationsMiscellaneousNpgsqlTest( + NavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r0."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE r0."Int" = 8 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +WHERE r0."Int" = 8 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n0 ON r1."OptionalNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."RequiredNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r0."OptionalNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE n."Int" = 8 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsNpgsqlFixture.cs index efeff7c52b..e0153c1d13 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsNpgsqlFixture.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsNpgsqlFixture.cs @@ -1,10 +1,10 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class NavigationsNpgsqlFixture : NavigationsRelationalFixtureBase, ITestSqlLoggerFactory +namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; + +public class NavigationsNpgsqlFixture : NavigationsRelationalFixtureBase { protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsProjectionNpgsqlTest.cs index 39b1f62d5d..593f509f45 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsProjectionNpgsqlTest.cs @@ -1,409 +1,371 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class NavigationsProjectionNpgsqlTest - : NavigationsProjectionRelationalTestBase -{ - public NavigationsProjectionNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } +namespace Microsoft.EntityFrameworkCore.Query.Relationships.Navigations; - public override async Task Select_root(bool async, QueryTrackingBehavior queryTrackingBehavior) +public class NavigationsProjectionNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root(async, queryTrackingBehavior); + await base.Select_root(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST """); } - public override async Task Select_trunk_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_optional(async, queryTrackingBehavior); + #region Simple properties - AssertSql( - """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" -ORDER BY r."Id" NULLS FIRST -"""); - } - - public override async Task Select_trunk_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_required(async, queryTrackingBehavior); + await base.Select_property_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r0."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" """); } - public override async Task Select_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_collection(async, queryTrackingBehavior); + await base.Select_property_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."Id" = t."CollectionRootId" -ORDER BY r."Id" NULLS FIRST +SELECT r0."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" """); } - public override async Task Select_branch_required_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_required(async, queryTrackingBehavior); + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); AssertSql( """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r0."Int" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" """); } - public override async Task Select_branch_required_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_optional(async, queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); AssertSql( """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."OptionalReferenceBranchId" = b."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r0."Int" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" """); } - public override async Task Select_branch_optional_required(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_optional_required(async, queryTrackingBehavior); + #endregion Simple properties - AssertSql( - """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -ORDER BY r."Id" NULLS FIRST -"""); - } + #region Non-collection - public override async Task Select_branch_optional_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); + await base.Select_related(queryTrackingBehavior); AssertSql( """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."OptionalReferenceBranchId" = b."Id" -ORDER BY r."Id" NULLS FIRST +SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +INNER JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."Id" = n1."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_branch_required_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_collection(async, queryTrackingBehavior); + await base.Select_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", t."Id", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST +SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."Id" = n1."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_branch_optional_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_collection(async, queryTrackingBehavior); + await base.Select_required_nested_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", t."Id", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" """); } - #region Multiple - - public override async Task Select_root_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root_duplicated(async, queryTrackingBehavior); + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" """); } - public override async Task Select_trunk_and_branch_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_branch_duplicated(async, queryTrackingBehavior); + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -ORDER BY r."Id" NULLS FIRST +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" """); } - public override async Task Select_trunk_and_trunk_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_trunk_duplicated(async, queryTrackingBehavior); + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", l."Id", l."CollectionBranchId", l."Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN "BranchEntities" AS b ON t."OptionalReferenceBranchId" = b."Id" -LEFT JOIN "LeafEntities" AS l ON b."RequiredReferenceLeafId" = l."Id" -ORDER BY r."Id" NULLS FIRST +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" """); } - public override async Task Select_leaf_trunk_root(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); AssertSql( """ -SELECT l."Id", l."CollectionBranchId", l."Name", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -INNER JOIN "LeafEntities" AS l ON b."RequiredReferenceLeafId" = l."Id" +SELECT r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r."Id", r0."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r0."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."Id" = n1."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_multiple_branch_leaf(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_multiple_branch_leaf(async, queryTrackingBehavior); - - AssertSql( - """ -SELECT r."Id", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId", l."Id", l."CollectionBranchId", l."Name", t."Id", l0."Id", l0."CollectionBranchId", l0."Name", b0."Id", b0."CollectionTrunkId", b0."Name", b0."OptionalReferenceLeafId", b0."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -LEFT JOIN "LeafEntities" AS l ON b."OptionalReferenceLeafId" = l."Id" -LEFT JOIN "LeafEntities" AS l0 ON b."Id" = l0."CollectionBranchId" -LEFT JOIN "BranchEntities" AS b0 ON t."Id" = b0."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST, b."Id" NULLS FIRST, l."Id" NULLS FIRST, l0."Id" NULLS FIRST -"""); - } - - #endregion Multiple + #endregion Non-collection - #region Subquery + #region Collection - public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_related_collection(queryTrackingBehavior); AssertSql( """ -SELECT s."Id", s."CollectionTrunkId", s."Name", s."OptionalReferenceLeafId", s."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" - FROM "RootEntities" AS r0 - INNER JOIN "TrunkEntities" AS t ON r0."RequiredReferenceTrunkId" = t."Id" - INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -ORDER BY r."Id" NULLS FIRST +SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2" +FROM "RootEntity" AS r +LEFT JOIN ( + SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id" AS "Id0", n0."Id" AS "Id1", n1."Id" AS "Id2", n1."CollectionRelatedId", n1."Int" AS "Int0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionRelatedId" AS "CollectionRelatedId0", n."Int" AS "Int1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionRelatedId" AS "CollectionRelatedId1", n0."Int" AS "Int2", n0."Name" AS "Name2", n0."String" AS "String2" + FROM "RelatedType" AS r0 + LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" + INNER JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" + LEFT JOIN "NestedType" AS n1 ON r0."Id" = n1."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST """); } - public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT s."Id", s."CollectionTrunkId", s."Name", s."OptionalReferenceLeafId", s."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" - FROM "RootEntities" AS r0 - LEFT JOIN "TrunkEntities" AS t ON r0."OptionalReferenceTrunkId" = t."Id" - LEFT JOIN "BranchEntities" AS b ON t."OptionalReferenceBranchId" = b."Id" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -ORDER BY r."Id" NULLS FIRST +SELECT r."Id", r0."Id", n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."Id" = n."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST """); } - public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async, queryTrackingBehavior); + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", s."Id", s."Id0", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId", s.c -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT 1 AS c, r0."Id", t."Id" AS "Id0" - FROM "RootEntities" AS r0 - INNER JOIN "TrunkEntities" AS t ON r0."RequiredReferenceTrunkId" = t."Id" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN "BranchEntities" AS b ON s."Id0" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST +SELECT r."Id", r0."Id", n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."Id" = n."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST """); } - public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async, queryTrackingBehavior); + await base.SelectMany_related_collection(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", t."Id", b."Id", s."Id1", s."Id", s."Id0", b1."Id", b1."CollectionTrunkId", b1."Name", b1."OptionalReferenceLeafId", b1."RequiredReferenceLeafId", s."CollectionRootId", s."Name", s."OptionalReferenceBranchId", s."RequiredReferenceBranchId", s."CollectionTrunkId", s."Name0", s."OptionalReferenceLeafId", s."RequiredReferenceLeafId", s."Name1", s.c -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."RequiredReferenceBranchId" = b."Id" -LEFT JOIN LATERAL ( - SELECT t0."Id", t0."CollectionRootId", t0."Name", t0."OptionalReferenceBranchId", t0."RequiredReferenceBranchId", b0."Id" AS "Id0", b0."CollectionTrunkId", b0."Name" AS "Name0", b0."OptionalReferenceLeafId", b0."RequiredReferenceLeafId", b."Name" AS "Name1", 1 AS c, r0."Id" AS "Id1" - FROM "RootEntities" AS r0 - INNER JOIN "TrunkEntities" AS t0 ON r0."RequiredReferenceTrunkId" = t0."Id" - INNER JOIN "BranchEntities" AS b0 ON t0."RequiredReferenceBranchId" = b0."Id" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN "BranchEntities" AS b1 ON t."Id" = b1."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST, b."Id" NULLS FIRST, s."Id1" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST +SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."Id" = r0."CollectionRootId" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +INNER JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."Id" = n1."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", t."Id", r1."Id", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId", r1.c -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -LEFT JOIN LATERAL ( - SELECT 1 AS c, r0."Id" - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r1 ON TRUE -LEFT JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -ORDER BY r."Id" NULLS FIRST, t."Id" NULLS FIRST, r1."Id" NULLS FIRST +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."Id" = n."CollectionRelatedId" """); } - #endregion Subquery - - #region SelectMany - - public override async Task SelectMany_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_trunk_collection(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); AssertSql( """ -SELECT t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."Id" = t."CollectionRootId" +SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."Id" = n."CollectionRelatedId" """); } - public override async Task SelectMany_required_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.SelectMany_required_trunk_reference_branch_collection(async, queryTrackingBehavior); + #endregion Collection - AssertSql( - """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."RequiredReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" -"""); - } + #region Multiple - public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_optional_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_root_duplicated(queryTrackingBehavior); AssertSql( """ -SELECT b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId" -FROM "RootEntities" AS r -LEFT JOIN "TrunkEntities" AS t ON r."OptionalReferenceTrunkId" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."Id" = b."CollectionTrunkId" +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", n8."Id", n8."CollectionRelatedId", n8."Int", n8."Name", n8."String", s0."Id", s0."CollectionRootId", s0."Int", s0."Name", s0."OptionalNestedId", s0."RequiredNestedId", s0."String", s0."Id0", s0."Id1", s0."Id2", s0."CollectionRelatedId", s0."Int0", s0."Name0", s0."String0", s0."CollectionRelatedId0", s0."Int1", s0."Name1", s0."String1", s0."CollectionRelatedId1", s0."Int2", s0."Name2", s0."String2", n12."Id", n12."CollectionRelatedId", n12."Int", n12."Name", n12."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedType" AS n8 ON r0."Id" = n8."CollectionRelatedId" +LEFT JOIN ( + SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n9."Id" AS "Id0", n10."Id" AS "Id1", n11."Id" AS "Id2", n11."CollectionRelatedId", n11."Int" AS "Int0", n11."Name" AS "Name0", n11."String" AS "String0", n9."CollectionRelatedId" AS "CollectionRelatedId0", n9."Int" AS "Int1", n9."Name" AS "Name1", n9."String" AS "String1", n10."CollectionRelatedId" AS "CollectionRelatedId1", n10."Int" AS "Int2", n10."Name" AS "Name2", n10."String" AS "String2" + FROM "RelatedType" AS r3 + LEFT JOIN "NestedType" AS n9 ON r3."OptionalNestedId" = n9."Id" + INNER JOIN "NestedType" AS n10 ON r3."RequiredNestedId" = n10."Id" + LEFT JOIN "NestedType" AS n11 ON r3."Id" = n11."CollectionRelatedId" +) AS s0 ON r."Id" = s0."CollectionRootId" +LEFT JOIN "NestedType" AS n12 ON r1."Id" = n12."CollectionRelatedId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n7."Id" NULLS FIRST, n8."Id" NULLS FIRST, s0."Id" NULLS FIRST, s0."Id0" NULLS FIRST, s0."Id1" NULLS FIRST, s0."Id2" NULLS FIRST """); } - #endregion SelectMany + #endregion Multiple - #region NavigationProjectionTestBase + #region Subquery - public override async Task Select_everything(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_everything(async, queryTrackingBehavior); + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId", l."Id", l."CollectionBranchId", l."Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."Id" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."Id" = b."Id" -INNER JOIN "LeafEntities" AS l ON b."Id" = l."Id" +SELECT s."Id", s."CollectionRelatedId", s."Int", s."Name", s."String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" + FROM "RootEntity" AS r0 + INNER JOIN "RelatedType" AS r1 ON r0."RequiredRelatedId" = r1."Id" + INNER JOIN "NestedType" AS n ON r1."RequiredNestedId" = n."Id" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS s ON TRUE """); } - public override async Task Select_everything_using_joins(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_everything_using_joins(async, queryTrackingBehavior); + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", t."Id", t."CollectionRootId", t."Name", t."OptionalReferenceBranchId", t."RequiredReferenceBranchId", b."Id", b."CollectionTrunkId", b."Name", b."OptionalReferenceLeafId", b."RequiredReferenceLeafId", l."Id", l."CollectionBranchId", l."Name" -FROM "RootEntities" AS r -INNER JOIN "TrunkEntities" AS t ON r."Id" = t."Id" -INNER JOIN "BranchEntities" AS b ON t."Id" = b."Id" -INNER JOIN "LeafEntities" AS l ON b."Id" = l."Id" +SELECT s."Id", s."CollectionRelatedId", s."Int", s."Name", s."String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT n."Id", n."CollectionRelatedId", n."Int", n."Name", n."String" + FROM "RootEntity" AS r0 + LEFT JOIN "RelatedType" AS r1 ON r0."OptionalRelatedId" = r1."Id" + LEFT JOIN "NestedType" AS n ON r1."RequiredNestedId" = n."Id" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS s ON TRUE """); } - #endregion NavigationProjectionTestBase + #endregion Subquery [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsSetOperationsNpgsqlTest.cs new file mode 100644 index 0000000000..d27b588183 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsSetOperationsNpgsqlTest.cs @@ -0,0 +1,159 @@ +// 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.Relationships.Navigations; + +public class NavigationsSetOperationsNpgsqlTest( + NavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task On_related() + { + await base.On_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n."Id", n0."Id", r3."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r3."CollectionRootId", r3."Int", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r2 ON r."OptionalRelatedId" = r2."Id" +LEFT JOIN "NestedType" AS n ON r2."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r2."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r3 ON r."RequiredRelatedId" = r3."Id" +LEFT JOIN "NestedType" AS n1 ON r3."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r3."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r2."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r4."Id", r4."CollectionRootId", r4."Int", r4."Name", r4."OptionalNestedId", r4."RequiredNestedId", r4."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r4 + LEFT JOIN "NestedType" AS n4 ON r4."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r4."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r4."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r3."Id" = n7."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" AND r0."Int" = 8 + UNION ALL + SELECT 1 + FROM "RelatedType" AS r1 + WHERE r."Id" = r1."CollectionRootId" AND r1."String" = 'foo' + ) AS u) = 4 +ORDER BY r."Id" NULLS FIRST, r2."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r3."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.On_related_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + { + await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT COALESCE(sum(n."Int"), 0)::int + FROM "NestedType" AS n + WHERE u."Id" = n."CollectionRelatedId")), 0)::int + FROM ( + SELECT r0."Id" + FROM "RelatedType" AS r0 + WHERE r."Id" = r0."CollectionRootId" AND r0."Int" = 8 + UNION ALL + SELECT r1."Id" + FROM "RelatedType" AS r1 + WHERE r."Id" = r1."CollectionRootId" AND r1."String" = 'foo' + ) AS u) +FROM "RootEntity" AS r +"""); + } + + public override async Task On_nested() + { + await base.On_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n1."Id", n2."Id", n3."Id", n4."Id", n5."Id", n5."CollectionRelatedId", n5."Int", n5."Name", n5."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n9."Id", n9."CollectionRelatedId", n9."Int", n9."Name", n9."String", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n4."CollectionRelatedId", n4."Int", n4."Name", n4."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."OptionalNestedId" = n3."Id" +INNER JOIN "NestedType" AS n4 ON r0."RequiredNestedId" = n4."Id" +LEFT JOIN "NestedType" AS n5 ON r1."Id" = n5."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n6."Id" AS "Id0", n7."Id" AS "Id1", n8."Id" AS "Id2", n8."CollectionRelatedId", n8."Int" AS "Int0", n8."Name" AS "Name0", n8."String" AS "String0", n6."CollectionRelatedId" AS "CollectionRelatedId0", n6."Int" AS "Int1", n6."Name" AS "Name1", n6."String" AS "String1", n7."CollectionRelatedId" AS "CollectionRelatedId1", n7."Int" AS "Int2", n7."Name" AS "Name2", n7."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n6 ON r2."OptionalNestedId" = n6."Id" + INNER JOIN "NestedType" AS n7 ON r2."RequiredNestedId" = n7."Id" + LEFT JOIN "NestedType" AS n8 ON r2."Id" = n8."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n9 ON r0."Id" = n9."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM "NestedType" AS n + WHERE r0."Id" = n."CollectionRelatedId" AND n."Int" = 8 + UNION ALL + SELECT 1 + FROM "NestedType" AS n0 + WHERE r0."Id" = n0."CollectionRelatedId" AND n0."String" = 'foo' + ) AS u) = 4 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, n5."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Over_different_collection_properties() + { + await base.Over_different_collection_properties(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n1."Id", n2."Id", n3."Id", n4."Id", n5."Id", n5."CollectionRelatedId", n5."Int", n5."Name", n5."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n9."Id", n9."CollectionRelatedId", n9."Int", n9."Name", n9."String", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n4."CollectionRelatedId", n4."Int", n4."Name", n4."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."OptionalNestedId" = n3."Id" +INNER JOIN "NestedType" AS n4 ON r0."RequiredNestedId" = n4."Id" +LEFT JOIN "NestedType" AS n5 ON r1."Id" = n5."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n6."Id" AS "Id0", n7."Id" AS "Id1", n8."Id" AS "Id2", n8."CollectionRelatedId", n8."Int" AS "Int0", n8."Name" AS "Name0", n8."String" AS "String0", n6."CollectionRelatedId" AS "CollectionRelatedId0", n6."Int" AS "Int1", n6."Name" AS "Name1", n6."String" AS "String1", n7."CollectionRelatedId" AS "CollectionRelatedId1", n7."Int" AS "Int2", n7."Name" AS "Name2", n7."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n6 ON r2."OptionalNestedId" = n6."Id" + INNER JOIN "NestedType" AS n7 ON r2."RequiredNestedId" = n7."Id" + LEFT JOIN "NestedType" AS n8 ON r2."Id" = n8."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n9 ON r0."Id" = n9."CollectionRelatedId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM "NestedType" AS n + WHERE r0."Id" = n."CollectionRelatedId" + UNION ALL + SELECT 1 + FROM "NestedType" AS n0 + WHERE r1."Id" IS NOT NULL AND r1."Id" = n0."CollectionRelatedId" + ) AS u) = 4 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, n5."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..1fb18b73c9 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,282 @@ +// 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.Relationships.Navigations; + +public class NavigationsStructuralEqualityNpgsqlTest( + NavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r0."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE r0."Id" = r1."Id" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r0."OptionalNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE n."Id" = n0."Id" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r0."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE r0."Id" <> r1."Id" OR r1."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +WHERE r0."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n."Id", n0."Id", r1."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r0."RequiredNestedId" = n0."Id" +INNER JOIN "RelatedType" AS r1 ON r."RequiredRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n1 ON r1."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r1."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r0."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r1."Id" = n7."CollectionRelatedId" +WHERE r0."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "NestedType" AS n ON r0."OptionalNestedId" = n."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n0 ON r1."OptionalNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."RequiredNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r0."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE n."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n0 ON r1."OptionalNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."RequiredNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r0."OptionalNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE n."Id" = 1000 +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql( + """ +@entity_equality_nested_Id='1000' (Nullable = true) + +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "NestedType" AS n ON r0."RequiredNestedId" = n."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n0 ON r1."OptionalNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r1."RequiredNestedId" = n1."Id" +LEFT JOIN "NestedType" AS n2 ON r0."OptionalNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE n."Id" = @entity_equality_nested_Id +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, n."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n."Id", n0."Id", n1."Id", n2."Id", n3."Id", n3."CollectionRelatedId", n3."Int", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Name", n2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +LEFT JOIN "RelatedType" AS r1 ON r."OptionalRelatedId" = r1."Id" +LEFT JOIN "NestedType" AS n ON r1."OptionalNestedId" = n."Id" +LEFT JOIN "NestedType" AS n0 ON r1."RequiredNestedId" = n0."Id" +LEFT JOIN "NestedType" AS n1 ON r0."OptionalNestedId" = n1."Id" +INNER JOIN "NestedType" AS n2 ON r0."RequiredNestedId" = n2."Id" +LEFT JOIN "NestedType" AS n3 ON r1."Id" = n3."CollectionRelatedId" +LEFT JOIN ( + SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionRelatedId", n6."Int" AS "Int0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "RelatedType" AS r2 + LEFT JOIN "NestedType" AS n4 ON r2."OptionalNestedId" = n4."Id" + INNER JOIN "NestedType" AS n5 ON r2."RequiredNestedId" = n5."Id" + LEFT JOIN "NestedType" AS n6 ON r2."Id" = n6."CollectionRelatedId" +) AS s ON r."Id" = s."CollectionRootId" +LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +WHERE r0."Id" = r1."Id" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs new file mode 100644 index 0000000000..415b4bb264 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs @@ -0,0 +1,248 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonCollectionNpgsqlTest(OwnedJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedJsonCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb + )) WITH ORDINALITY AS r0) = 2 +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text + )) WITH ORDINALITY AS r0 + WHERE r0."Int" <> 8) = 2 +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT r0."Int" + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text + )) WITH ORDINALITY AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 OFFSET 0) = 8 +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE ( + SELECT count(*)::int + FROM ( + SELECT DISTINCT r."Id", r0."Id" AS "Id0", r0."Int", r0."Name", r0."String", r0."NestedCollection" AS c, r0."OptionalNested" AS c0, r0."RequiredNested" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb + )) WITH ORDINALITY AS r0 + ) AS r1) = 2 +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", r1."Id", r1."Id0", r1."Int", r1."Name", r1."String", r1.c, r1.c0, r1.c1 +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT DISTINCT r."Id", r0."Id" AS "Id0", r0."Int", r0."Name", r0."String", r0."NestedCollection" AS c, r0."OptionalNested" AS c0, r0."RequiredNested" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb + )) WITH ORDINALITY AS r0 +) AS r1 ON TRUE +ORDER BY r."Id" NULLS FIRST, r1."Id0" NULLS FIRST, r1."Int" NULLS FIRST, r1."Name" NULLS FIRST +"""); + } + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> '{0,Int}' AS integer)) = 8 +"""); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql( + """ +@i='?' (DbType = Int32) + +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 +"""); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 +"""); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RelatedCollection" #>> '{9999,Int}' AS integer)) = 8 +"""); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE 16 IN ( + SELECT COALESCE(sum(r1."Int"), 0)::int + FROM ( + SELECT r0."Id" AS "Id0", r0."Int", r0."Name", r0."String", r0."String" AS "Key" + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text + )) WITH ORDINALITY AS r0 + ) AS r1 + GROUP BY r1."Key" +) +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT max(n."Int") + FROM ROWS FROM (jsonb_to_recordset(r0."NestedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text + )) WITH ORDINALITY AS n)), 0)::int + FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS r0) +FROM "RootEntity" AS r +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..a8f6d8575a --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs @@ -0,0 +1,54 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonMiscellaneousNpgsqlTest( + OwnedJsonNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RequiredRelated" ->> 'Int' AS integer)) = 8 +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."OptionalRelated" ->> 'Int' AS integer)) = 8 +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (CAST(r."RequiredRelated" #>> '{RequiredNested,Int}' AS integer)) = 8 +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonNpgsqlFixture.cs new file mode 100644 index 0000000000..e5ac0e1c64 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonNpgsqlFixture.cs @@ -0,0 +1,10 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonNpgsqlFixture : OwnedJsonRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => NpgsqlTestStoreFactory.Instance; +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs new file mode 100644 index 0000000000..5617daa84a --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs @@ -0,0 +1,345 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonProjectionNpgsqlTest(OwnedJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedJsonProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +"""); + } + + #region Simple properties + + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_required_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredRelated" ->> 'String' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."OptionalRelated" ->> 'String' +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + + #endregion Simple properties + + #region Non-collection + + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RequiredRelated", r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."OptionalRelated", r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RequiredRelated" -> 'RequiredNested', r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RequiredRelated" -> 'OptionalNested', r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."OptionalRelated" -> 'RequiredNested', r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."OptionalRelated" -> 'OptionalNested', r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r0."RequiredRelated", r0."Id" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +"""); + } + } + + #endregion Non-collection + + #region Collection + + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_related_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RelatedCollection", r."Id" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + } + + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RequiredRelated" -> 'NestedCollection', r."Id" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + } + + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."OptionalRelated" -> 'NestedCollection', r."Id" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + } + + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_related_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", r0."Id", r0."Int", r0."Name", r0."String", r0."NestedCollection", r0."OptionalNested", r0."RequiredNested" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text, + "NestedCollection" jsonb, + "OptionalNested" jsonb, + "RequiredNested" jsonb +)) WITH ORDINALITY AS r0 ON TRUE +"""); + } + } + + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", n."Id", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text +)) WITH ORDINALITY AS n ON TRUE +"""); + } + } + + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", n."Id", n."Int", n."Name", n."String" +FROM "RootEntity" AS r +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalRelated" -> 'NestedCollection') AS ( + "Id" integer, + "Int" integer, + "Name" text, + "String" text +)) WITH ORDINALITY AS n ON TRUE +"""); + } + } + + #endregion Collection + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r1.c, r1."Id" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."RequiredRelated" -> 'RequiredNested' AS c, r0."Id" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); + } + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r1.c, r1."Id" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."OptionalRelated" -> 'RequiredNested' AS c, r0."Id" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE +"""); + } + } + + #endregion Subquery + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..78c37426a9 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,126 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonStructuralEqualityNpgsqlTest( + OwnedJsonNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE FALSE +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE FALSE +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE FALSE +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."OptionalRelated") IS NULL +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE FALSE +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE (r."RequiredRelated" ->> 'OptionalNested') IS NULL +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql(); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql(); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +FROM "RootEntity" AS r +WHERE FALSE +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonTypeNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonTypeNpgsqlFixture.cs new file mode 100644 index 0000000000..1f24f1c32b --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedJson/OwnedJsonTypeNpgsqlFixture.cs @@ -0,0 +1,22 @@ +// 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.Relationships.OwnedJson; + +public class OwnedJsonTypeNpgsqlFixture : OwnedJsonRelationalFixtureBase +{ + protected override string StoreName + => "OwnedJsonTypeRelationshipsQueryTest"; + + protected override ITestStoreFactory TestStoreFactory + => NpgsqlTestStoreFactory.Instance; + + // protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + // { + // base.OnModelCreating(modelBuilder, context); + + // modelBuilder.Entity().OwnsOne(x => x.RequiredTrunk).HasColumnType("json"); + // modelBuilder.Entity().OwnsOne(x => x.OptionalTrunk).HasColumnType("json"); + // modelBuilder.Entity().OwnsMany(x => x.CollectionTrunk).HasColumnType("json"); + // } +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs new file mode 100644 index 0000000000..2de2ba1394 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs @@ -0,0 +1,273 @@ +// 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.Relationships.OwnedNavigations; + +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedNavigationsCollectionNpgsqlTest(OwnedNavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedNavigationsCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r1."Id", r1."Int", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Name", r8."String", r2."Id", r2."Int", r2."Name", r2."String", r3."Id", r3."Int", r3."Name", r3."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r1 ON r."Id" = r1."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Name", r4."String", r5."RelatedTypeRootEntityId", r5."RelatedTypeId", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r6."RelatedTypeId" AS "RelatedTypeId0", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r7."RelatedTypeId" AS "RelatedTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Name" AS "Name2", r6."String" AS "String2" + FROM "RelatedCollection" AS r4 + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."RelatedTypeRootEntityId" AND r4."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."RelatedTypeRootEntityId" AND r4."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."RelatedTypeRootEntityId" AND r4."Id" = r7."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +WHERE ( + SELECT count(*)::int + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId") = 2 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r8."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r1."Id", r1."Int", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Name", r8."String", r2."Id", r2."Int", r2."Name", r2."String", r3."Id", r3."Int", r3."Name", r3."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r1 ON r."Id" = r1."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Name", r4."String", r5."RelatedTypeRootEntityId", r5."RelatedTypeId", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r6."RelatedTypeId" AS "RelatedTypeId0", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r7."RelatedTypeId" AS "RelatedTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Name" AS "Name2", r6."String" AS "String2" + FROM "RelatedCollection" AS r4 + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."RelatedTypeRootEntityId" AND r4."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."RelatedTypeRootEntityId" AND r4."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."RelatedTypeRootEntityId" AND r4."Id" = r7."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +WHERE ( + SELECT count(*)::int + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" AND r0."Int" <> 8) = 2 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r8."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r1."Id", r1."Int", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Name", r8."String", r2."Id", r2."Int", r2."Name", r2."String", r3."Id", r3."Int", r3."Name", r3."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r1 ON r."Id" = r1."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Name", r4."String", r5."RelatedTypeRootEntityId", r5."RelatedTypeId", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r6."RelatedTypeId" AS "RelatedTypeId0", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r7."RelatedTypeId" AS "RelatedTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Name" AS "Name2", r6."String" AS "String2" + FROM "RelatedCollection" AS r4 + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."RelatedTypeRootEntityId" AND r4."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."RelatedTypeRootEntityId" AND r4."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."RelatedTypeRootEntityId" AND r4."Id" = r7."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +WHERE ( + SELECT r0."Int" + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 OFFSET 0) = 8 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r8."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r2."Id", r2."Int", r2."Name", r2."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Name", r9."String", r3."Id", r3."Int", r3."Name", r3."String", r4."Id", r4."Int", r4."Name", r4."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r2 ON r."Id" = r2."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r3 ON r2."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r2."RootEntityId" = r4."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Name", r5."String", r6."RelatedTypeRootEntityId", r6."RelatedTypeId", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r7."RelatedTypeId" AS "RelatedTypeId0", r8."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r8."RelatedTypeId" AS "RelatedTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Name" AS "Name2", r7."String" AS "String2" + FROM "RelatedCollection" AS r5 + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."RelatedTypeRootEntityId" AND r5."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."RelatedTypeRootEntityId" AND r5."Id" = r7."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."RelatedTypeRootEntityId" AND r5."Id" = r8."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."RelatedTypeRootEntityId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT DISTINCT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String" + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" + ) AS r1) = 2 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r2."RootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, r4."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r9."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."Id00", s."Int00", s."Name00", s."String00", s."RelatedTypeRootEntityId00", s."RelatedTypeId00", s."Id1", s."Int1", s."Name1", s."String1" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Name", r1."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Name" AS "Name0", r4."String" AS "String0", r1."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r1."RelatedTypeId" AS "RelatedTypeId0", r1."Id0" AS "Id00", r1."Int0" AS "Int00", r1."Name0" AS "Name00", r1."String0" AS "String00", r1."RelatedTypeRootEntityId0" AS "RelatedTypeRootEntityId00", r1."RelatedTypeId0" AS "RelatedTypeId00", r1."Id1", r1."Int1", r1."Name1", r1."String1" + FROM ( + SELECT DISTINCT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r2."RelatedTypeRootEntityId", r2."RelatedTypeId", r2."Id" AS "Id0", r2."Int" AS "Int0", r2."Name" AS "Name0", r2."String" AS "String0", r3."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r3."RelatedTypeId" AS "RelatedTypeId0", r3."Id" AS "Id1", r3."Int" AS "Int1", r3."Name" AS "Name1", r3."String" AS "String1" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_OptionalNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" AND r0."Id" = r2."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r3 ON r0."RootEntityId" = r3."RelatedTypeRootEntityId" AND r0."Id" = r3."RelatedTypeId" + WHERE r."Id" = r0."RootEntityId" + ) AS r1 + LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r1."RootEntityId" = r4."RelatedTypeRootEntityId" AND r1."Id" = r4."RelatedTypeId" +) AS s ON TRUE +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST +"""); + } + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql(); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql(); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql(); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql(); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r1."Id", r1."Int", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Name", r8."String", r2."Id", r2."Int", r2."Name", r2."String", r3."Id", r3."Int", r3."Name", r3."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r1 ON r."Id" = r1."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Name", r4."String", r5."RelatedTypeRootEntityId", r5."RelatedTypeId", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r6."RelatedTypeId" AS "RelatedTypeId0", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r7."RelatedTypeId" AS "RelatedTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Name" AS "Name2", r6."String" AS "String2" + FROM "RelatedCollection" AS r4 + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."RelatedTypeRootEntityId" AND r4."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."RelatedTypeRootEntityId" AND r4."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."RelatedTypeRootEntityId" AND r4."Id" = r7."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +WHERE 16 IN ( + SELECT COALESCE(sum(r0."Int"), 0)::int + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" + GROUP BY r0."String" +) +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r8."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT max(r1."Int") + FROM "RelatedCollection_NestedCollection" AS r1 + WHERE r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId")), 0)::int + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId") +FROM "RootEntity" AS r +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..fa1c4d74aa --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs @@ -0,0 +1,103 @@ +// 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.Relationships.OwnedNavigations; + +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedNavigationsMiscellaneousNpgsqlTest( + OwnedNavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE r0."Int" = 8 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE o."Int" = 8 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r2."Id", r2."Int", r2."Name", r2."String", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE r1."Int" = 8 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsNpgsqlFixture.cs index 9eb93df277..9b9fbcf5da 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsNpgsqlFixture.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsNpgsqlFixture.cs @@ -1,10 +1,10 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class OwnedNavigationsNpgsqlFixture : OwnedNavigationsRelationalFixtureBase, ITestSqlLoggerFactory +namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; + +public class OwnedNavigationsNpgsqlFixture : OwnedNavigationsRelationalFixtureBase { protected override ITestStoreFactory TestStoreFactory => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs index 7ef3a11e73..8777f5686b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs @@ -1,798 +1,417 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class OwnedNavigationsProjectionNpgsqlTest - : OwnedNavigationsProjectionRelationalTestBase -{ - public OwnedNavigationsProjectionNpgsqlTest(OwnedNavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } +namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedNavigations; - public override async Task Select_root(bool async, QueryTrackingBehavior queryTrackingBehavior) +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedNavigationsProjectionNpgsqlTest(OwnedNavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedNavigationsProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root(async, queryTrackingBehavior); + await base.Select_root(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchId1", s0."Id100", s0."Name00", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", s0."OptionalReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."Id11", s0."Name1", s0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", s0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", s0."RequiredReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."Id12", s0."Name2", s0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", s0."RequiredReferenceBranch_RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."Id10", s1."Name0", s1."OptionalReferenceLeaf_Name", s1."RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."Id1", r8."Name", r."OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."Id10", s2."Name0", s2."OptionalReferenceLeaf_Name", s2."RequiredReferenceLeaf_Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkId1", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsBranchId1", s."Id10" AS "Id100", s."Name0" AS "Name00", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r0."OptionalReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r3."Id1" AS "Id11", r3."Name" AS "Name1", r0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r0."RequiredReferenceBranch_Name", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r4."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r4."Id1" AS "Id12", r4."Name" AS "Name2", r0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r0."RequiredReferenceBranch_RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk" AS r0 - LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" AND r1."Id1" = r2."RelationshipsBranchId1" - ) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."RelationshipsRootId" - END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."Id1" - END = r3."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" LEFT JOIN ( - SELECT r5."RelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchId1", r6."Id1" AS "Id10", r6."Name" AS "Name0", r5."OptionalReferenceLeaf_Name", r5."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r5 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r6 ON r5."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r5."Id1" = r6."RelationshipsBranchId1" -) AS s1 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r7 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r8 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r9."RelationshipsTrunkRelationshipsRootId", r9."Id1", r9."Name", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchId1", r10."Id1" AS "Id10", r10."Name" AS "Name0", r9."OptionalReferenceLeaf_Name", r9."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r9 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r9."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r9."Id1" = r10."RelationshipsBranchId1" -) AS s2 ON r."Id" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r11 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r12 ON r."Id" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."Id12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."Id10" NULLS FIRST, r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."Id1" NULLS FIRST, r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r8."Id1" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST """); } - public override async Task Select_trunk_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + #region Simple properties + + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_optional(async, queryTrackingBehavior); + await base.Select_property_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", r."OptionalReferenceTrunk_Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r."OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r2 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."Id1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT r0."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" """); - } } - public override async Task Select_trunk_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_required(async, queryTrackingBehavior); + await base.Select_property_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", r."RequiredReferenceTrunk_Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r2 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r3 ON r."Id" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."Id1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT o."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" """); - } } - public override async Task Select_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_collection(async, queryTrackingBehavior); + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchId1", s0."Id100", s0."Name00", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", s0."OptionalReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."Id11", s0."Name1", s0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", s0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", s0."RequiredReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."Id12", s0."Name2", s0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", s0."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkId1", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsBranchId1", s."Id10" AS "Id100", s."Name0" AS "Name00", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r0."OptionalReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r3."Id1" AS "Id11", r3."Name" AS "Name1", r0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r0."RequiredReferenceBranch_Name", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r4."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r4."Id1" AS "Id12", r4."Name" AS "Name2", r0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r0."RequiredReferenceBranch_RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk" AS r0 - LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" AND r1."Id1" = r2."RelationshipsBranchId1" - ) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."RelationshipsRootId" - END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."Id1" - END = r3."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST + AssertSql( + """ +SELECT o."Int" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" """); - } } - public override async Task Select_branch_required_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_required(async, queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r0 ON r."Id" = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT o."Int" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" """); - } } - public override async Task Select_branch_required_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_optional(async, queryTrackingBehavior); + #endregion Simple properties - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r0 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST -"""); - } - } + #region Non-collection - public override async Task Select_branch_optional_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_required(async, queryTrackingBehavior); + await base.Select_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r0 ON r."Id" = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r3 ON r0."RootEntityId" = r3."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_branch_optional_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); + await base.Select_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r0 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT o."RootEntityId", o."Id", o."Int", o."Name", o."String", r."Id", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_branch_required_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); + await base.Select_required_nested_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r0 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" """); } } - public override async Task Select_branch_optional_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_collection(async, queryTrackingBehavior); + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST +SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" """); } } - #region Multiple - - public override async Task Select_root_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root_duplicated(async, queryTrackingBehavior); + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); - AssertSql( - """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchId1", s0."Id100", s0."Name00", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", s0."OptionalReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."Id11", s0."Name1", s0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", s0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", s0."RequiredReferenceBranch_Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."Id12", s0."Name2", s0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", s0."RequiredReferenceBranch_RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."Id10", s1."Name0", s1."OptionalReferenceLeaf_Name", s1."RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."Id1", r8."Name", r."OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."Id10", s2."Name0", s2."OptionalReferenceLeaf_Name", s2."RequiredReferenceLeaf_Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", s4."RelationshipsRootId", s4."Id1", s4."Name", s4."RelationshipsTrunkRelationshipsRootId", s4."RelationshipsTrunkId1", s4."Id10", s4."Name0", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s4."RelationshipsBranchRelationshipsTrunkId1", s4."RelationshipsBranchId1", s4."Id100", s4."Name00", s4."OptionalReferenceLeaf_Name", s4."RequiredReferenceLeaf_Name", s4."OptionalReferenceBranch_Name", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s4."RelationshipsBranchRelationshipsTrunkId10", s4."Id11", s4."Name1", s4."OptionalReferenceBranch_OptionalReferenceLeaf_Name", s4."OptionalReferenceBranch_RequiredReferenceLeaf_Name", s4."RequiredReferenceBranch_Name", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s4."RelationshipsBranchRelationshipsTrunkId11", s4."Id12", s4."Name2", s4."RequiredReferenceBranch_OptionalReferenceLeaf_Name", s4."RequiredReferenceBranch_RequiredReferenceLeaf_Name", s5."RelationshipsTrunkRelationshipsRootId", s5."Id1", s5."Name", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s5."RelationshipsBranchId1", s5."Id10", s5."Name0", s5."OptionalReferenceLeaf_Name", s5."RequiredReferenceLeaf_Name", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r20."Id1", r20."Name", r21."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r21."Id1", r21."Name", s6."RelationshipsTrunkRelationshipsRootId", s6."Id1", s6."Name", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s6."RelationshipsBranchId1", s6."Id10", s6."Name0", s6."OptionalReferenceLeaf_Name", s6."RequiredReferenceLeaf_Name", r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r24."Id1", r24."Name", r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r25."Id1", r25."Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkId1", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsBranchId1", s."Id10" AS "Id100", s."Name0" AS "Name00", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r0."OptionalReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r3."Id1" AS "Id11", r3."Name" AS "Name1", r0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r0."RequiredReferenceBranch_Name", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r4."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r4."Id1" AS "Id12", r4."Name" AS "Name2", r0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r0."RequiredReferenceBranch_RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk" AS r0 - LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" AND r1."Id1" = r2."RelationshipsBranchId1" - ) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."RelationshipsRootId" - END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."Id1" - END = r3."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -LEFT JOIN ( - SELECT r5."RelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchId1", r6."Id1" AS "Id10", r6."Name" AS "Name0", r5."OptionalReferenceLeaf_Name", r5."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r5 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r6 ON r5."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r5."Id1" = r6."RelationshipsBranchId1" -) AS s1 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r7 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r8 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r9."RelationshipsTrunkRelationshipsRootId", r9."Id1", r9."Name", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchId1", r10."Id1" AS "Id10", r10."Name" AS "Name0", r9."OptionalReferenceLeaf_Name", r9."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r9 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r9."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r9."Id1" = r10."RelationshipsBranchId1" -) AS s2 ON r."Id" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r11 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r12 ON r."Id" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r13."RelationshipsRootId", r13."Id1", r13."Name", s3."RelationshipsTrunkRelationshipsRootId", s3."RelationshipsTrunkId1", s3."Id1" AS "Id10", s3."Name" AS "Name0", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s3."RelationshipsBranchRelationshipsTrunkId1", s3."RelationshipsBranchId1", s3."Id10" AS "Id100", s3."Name0" AS "Name00", s3."OptionalReferenceLeaf_Name", s3."RequiredReferenceLeaf_Name", r13."OptionalReferenceBranch_Name", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r16."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r16."Id1" AS "Id11", r16."Name" AS "Name1", r13."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r13."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r13."RequiredReferenceBranch_Name", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r17."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r17."Id1" AS "Id12", r17."Name" AS "Name2", r13."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r13."RequiredReferenceBranch_RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk" AS r13 - LEFT JOIN ( - SELECT r14."RelationshipsTrunkRelationshipsRootId", r14."RelationshipsTrunkId1", r14."Id1", r14."Name", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r15."RelationshipsBranchRelationshipsTrunkId1", r15."RelationshipsBranchId1", r15."Id1" AS "Id10", r15."Name" AS "Name0", r14."OptionalReferenceLeaf_Name", r14."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r14 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r15 ON r14."RelationshipsTrunkRelationshipsRootId" = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."RelationshipsTrunkId1" = r15."RelationshipsBranchRelationshipsTrunkId1" AND r14."Id1" = r15."RelationshipsBranchId1" - ) AS s3 ON r13."RelationshipsRootId" = s3."RelationshipsTrunkRelationshipsRootId" AND r13."Id1" = s3."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r16 ON CASE - WHEN r13."OptionalReferenceBranch_Name" IS NOT NULL THEN r13."RelationshipsRootId" - END = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r13."OptionalReferenceBranch_Name" IS NOT NULL THEN r13."Id1" - END = r16."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r17 ON r13."RelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r13."Id1" = r17."RelationshipsBranchRelationshipsTrunkId1" -) AS s4 ON r."Id" = s4."RelationshipsRootId" -LEFT JOIN ( - SELECT r18."RelationshipsTrunkRelationshipsRootId", r18."Id1", r18."Name", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r19."RelationshipsBranchId1", r19."Id1" AS "Id10", r19."Name" AS "Name0", r18."OptionalReferenceLeaf_Name", r18."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r18 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r19 ON r18."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."Id1" = r19."RelationshipsBranchId1" -) AS s5 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s5."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r20 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r21 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r21."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r22."RelationshipsTrunkRelationshipsRootId", r22."Id1", r22."Name", r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r23."RelationshipsBranchId1", r23."Id1" AS "Id10", r23."Name" AS "Name0", r22."OptionalReferenceLeaf_Name", r22."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r22 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r23 ON r22."RelationshipsTrunkRelationshipsRootId" = r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r22."Id1" = r23."RelationshipsBranchId1" -) AS s6 ON r."Id" = s6."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r24 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r25 ON r."Id" = r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."Id12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."Id10" NULLS FIRST, r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."Id1" NULLS FIRST, r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r8."Id1" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."Id1" NULLS FIRST, s4."RelationshipsRootId" NULLS FIRST, s4."Id1" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsTrunkId1" NULLS FIRST, s4."Id10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s4."RelationshipsBranchId1" NULLS FIRST, s4."Id100" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s4."Id11" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s4."Id12" NULLS FIRST, s5."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."Id1" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."RelationshipsBranchId1" NULLS FIRST, s5."Id10" NULLS FIRST, r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r20."Id1" NULLS FIRST, r21."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r21."Id1" NULLS FIRST, s6."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."Id1" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."RelationshipsBranchId1" NULLS FIRST, s6."Id10" NULLS FIRST, r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r24."Id1" NULLS FIRST, r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST -"""); - } - - public override async Task Select_trunk_and_branch_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_trunk_and_branch_duplicated(async, queryTrackingBehavior); - - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."OptionalReferenceTrunk_Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r."OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."Id10", s0."Name0", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."Id1", r8."Name", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r9."Id1", r9."Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r2 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r4 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r5."RelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchId1", r6."Id1" AS "Id10", r6."Name" AS "Name0", r5."OptionalReferenceLeaf_Name", r5."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r5 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r6 ON r5."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r5."Id1" = r6."RelationshipsBranchId1" -) AS s0 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r7 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r8 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r9 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."Id1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."Id1" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id10" NULLS FIRST, r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."Id1" NULLS FIRST, r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r8."Id1" NULLS FIRST, r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" """); } } - public override async Task Select_trunk_and_trunk_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_trunk_duplicated(async, queryTrackingBehavior); + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."Id10", s0."Name0", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."Id1", r6."Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r2 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r3 ON r."Id" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r4."RelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchId1", r5."Id1" AS "Id10", r5."Name" AS "Name0", r4."OptionalReferenceLeaf_Name", r4."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r4 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."Id1" = r5."RelationshipsBranchId1" -) AS s0 ON r."Id" = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r6 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r7 ON r."Id" = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."Id1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id10" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."Id1" NULLS FIRST, r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" """); } } - public override async Task Select_leaf_trunk_root(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", s1."RelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."RelationshipsTrunkId1", s1."Id10", s1."Name0", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchRelationshipsTrunkId1", s1."RelationshipsBranchId1", s1."Id100", s1."Name00", s1."OptionalReferenceLeaf_Name", s1."RequiredReferenceLeaf_Name", s1."OptionalReferenceBranch_Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchRelationshipsTrunkId10", s1."Id11", s1."Name1", s1."OptionalReferenceBranch_OptionalReferenceLeaf_Name", s1."OptionalReferenceBranch_RequiredReferenceLeaf_Name", s1."RequiredReferenceBranch_Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchRelationshipsTrunkId11", s1."Id12", s1."Name2", s1."RequiredReferenceBranch_OptionalReferenceLeaf_Name", s1."RequiredReferenceBranch_RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."Id10", s2."Name0", s2."OptionalReferenceLeaf_Name", s2."RequiredReferenceLeaf_Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r."OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", s3."RelationshipsTrunkRelationshipsRootId", s3."Id1", s3."Name", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s3."RelationshipsBranchId1", s3."Id10", s3."Name0", s3."OptionalReferenceLeaf_Name", s3."RequiredReferenceLeaf_Name", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r15."Id1", r15."Name", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r16."Id1", r16."Name" -FROM "RootEntities" AS r -LEFT JOIN ( - SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1" AS "Id10", r1."Name" AS "Name0", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r2 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r3 ON r."Id" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r4."RelationshipsRootId", r4."Id1", r4."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."Id1" AS "Id10", s0."Name" AS "Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchId1", s0."Id10" AS "Id100", s0."Name0" AS "Name00", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", r4."OptionalReferenceBranch_Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r7."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r7."Id1" AS "Id11", r7."Name" AS "Name1", r4."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r4."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r4."RequiredReferenceBranch_Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r8."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r8."Id1" AS "Id12", r8."Name" AS "Name2", r4."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r4."RequiredReferenceBranch_RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk" AS r4 - LEFT JOIN ( - SELECT r5."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsTrunkId1", r5."Id1", r5."Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkId1", r6."RelationshipsBranchId1", r6."Id1" AS "Id10", r6."Name" AS "Name0", r5."OptionalReferenceLeaf_Name", r5."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r5 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r6 ON r5."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r5."RelationshipsTrunkId1" = r6."RelationshipsBranchRelationshipsTrunkId1" AND r5."Id1" = r6."RelationshipsBranchId1" - ) AS s0 ON r4."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" AND r4."Id1" = s0."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r7 ON CASE - WHEN r4."OptionalReferenceBranch_Name" IS NOT NULL THEN r4."RelationshipsRootId" - END = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r4."OptionalReferenceBranch_Name" IS NOT NULL THEN r4."Id1" - END = r7."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r8 ON r4."RelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."Id1" = r8."RelationshipsBranchRelationshipsTrunkId1" -) AS s1 ON r."Id" = s1."RelationshipsRootId" -LEFT JOIN ( - SELECT r9."RelationshipsTrunkRelationshipsRootId", r9."Id1", r9."Name", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchId1", r10."Id1" AS "Id10", r10."Name" AS "Name0", r9."OptionalReferenceLeaf_Name", r9."RequiredReferenceLeaf_Name" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r9 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r9."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r9."Id1" = r10."RelationshipsBranchId1" -) AS s2 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r11 ON CASE - WHEN r."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r12 ON CASE - WHEN r."OptionalReferenceTrunk_RequiredReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r13."RelationshipsTrunkRelationshipsRootId", r13."Id1", r13."Name", r14."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r14."RelationshipsBranchId1", r14."Id1" AS "Id10", r14."Name" AS "Name0", r13."OptionalReferenceLeaf_Name", r13."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r13 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r14 ON r13."RelationshipsTrunkRelationshipsRootId" = r14."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r13."Id1" = r14."RelationshipsBranchId1" -) AS s3 ON r."Id" = s3."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r15 ON CASE - WHEN r."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r."Id" -END = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r16 ON r."Id" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."Id1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."Id1" NULLS FIRST, s1."RelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsTrunkId1" NULLS FIRST, s1."Id10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."Id100" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s1."Id11" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s1."Id12" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."Id1" NULLS FIRST, s3."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s3."Id1" NULLS FIRST, s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s3."RelationshipsBranchId1" NULLS FIRST, s3."Id10" NULLS FIRST, r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r15."Id1" NULLS FIRST, r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Name", r1."String", r."Id", r0."Id", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", r4."Id", r4."Int", r4."Name", r4."String", r2."Id", r2."Int", r2."Name", r2."String", r3."Id", r3."Int", r3."Name", r3."String" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +LEFT JOIN "RequiredRelated" AS r1 ON r0."Id" = r1."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r4 ON r1."RootEntityId" = r4."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, r4."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_multiple_branch_leaf(bool async, QueryTrackingBehavior queryTrackingBehavior) + #endregion Non-collection + + #region Collection + + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_multiple_branch_leaf(async, queryTrackingBehavior); + await base.Select_related_collection(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r0 ON r."Id" = r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r1 ON r."Id" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2" +FROM "RootEntity" AS r LEFT JOIN ( - SELECT r2."RelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchId1", r3."Id1" AS "Id10", r3."Name" AS "Name0", r2."OptionalReferenceLeaf_Name", r2."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r2 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r3 ON r2."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r3."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r0."Id1" NULLS FIRST, r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."Id1" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r2."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r2."RelatedTypeId" AS "RelatedTypeId0", r3."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r3."RelatedTypeId" AS "RelatedTypeId1", r3."Id" AS "Id0", r3."Int" AS "Int0", r3."Name" AS "Name0", r3."String" AS "String0", r1."Id" AS "Id1", r1."Int" AS "Int1", r1."Name" AS "Name1", r1."String" AS "String1", r2."Id" AS "Id2", r2."Int" AS "Int2", r2."Name" AS "Name2", r2."String" AS "String2" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" AND r0."Id" = r2."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r3 ON r0."RootEntityId" = r3."RelatedTypeRootEntityId" AND r0."Id" = r3."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST """); } } - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r2."Id", r2."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r."Id", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r2."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT r0."Id", r0."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r0."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r0."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~" - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r2 ON TRUE -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r1 ON r2."Id" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r2."Id" NULLS FIRST, r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r0."RootEntityId", r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r2."Id", r2."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r."Id", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r2."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~" -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT r0."Id", r0."OptionalReferenceTrunk_OptionalReferenceBranch_Name", r0."OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r0."OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferen~" - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r2 ON TRUE -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r1 ON CASE - WHEN r2."OptionalReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r2."Id" -END = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r2."Id" NULLS FIRST, r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", o."RootEntityId", o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async, queryTrackingBehavior); + await base.SelectMany_related_collection(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r3."Id", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r3.c -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT 1 AS c, r0."Id" - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r3 ON TRUE -LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" -) AS s ON r3."Id" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r3."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r2."RelatedTypeRootEntityId", r2."RelatedTypeId", r3."RelatedTypeRootEntityId", r3."RelatedTypeId", r3."Id", r3."Int", r3."Name", r3."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +INNER JOIN "RelatedCollection" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RelatedCollection_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +LEFT JOIN "RelatedCollection_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" AND r0."Id" = r2."RelatedTypeId" +LEFT JOIN "RelatedCollection_NestedCollection" AS r3 ON r0."RootEntityId" = r3."RelatedTypeRootEntityId" AND r0."Id" = r3."RelatedTypeId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r0."Id" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r1."RelatedTypeId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r8."Id", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r8."RequiredReferenceTrunk_Name", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."Id10", s0."Name0", s0."OptionalReferenceLeaf_Name", s0."RequiredReferenceLeaf_Name", r8."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", r8."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r8."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r8."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."Id1", r6."Name", r8."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r8."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RequiredReferenceTrunk_RequiredReferenceBranch_Name0", r8.c -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT r0."Id", r0."RequiredReferenceTrunk_Name", r0."RequiredReferenceTrunk_OptionalReferenceBranch_Name", r0."RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferen~", r0."RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferen~", r0."RequiredReferenceTrunk_RequiredReferenceBranch_Name", r0."RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferen~", r0."RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferen~", r."RequiredReferenceTrunk_RequiredReferenceBranch_Name" AS "RequiredReferenceTrunk_RequiredReferenceBranch_Name0", 1 AS c - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r8 ON TRUE -LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r3."RelationshipsTrunkRelationshipsRootId", r3."Id1", r3."Name", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchId1", r4."Id1" AS "Id10", r4."Name" AS "Name0", r3."OptionalReferenceLeaf_Name", r3."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r3 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r4 ON r3."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r3."Id1" = r4."RelationshipsBranchId1" -) AS s0 ON r8."Id" = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf" AS r5 ON CASE - WHEN r8."RequiredReferenceTrunk_OptionalReferenceBranch_Name" IS NOT NULL THEN r8."Id" -END = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r6 ON r8."Id" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf" AS r7 ON r8."Id" = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r8."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."Id10" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."Id1" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."Id1" NULLS FIRST, r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +INNER JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" """); } } - public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r3."Id", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r3.c -FROM "RootEntities" AS r -LEFT JOIN LATERAL ( - SELECT 1 AS c, r0."Id" - FROM "RootEntities" AS r0 - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS r3 ON TRUE -LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" -) AS s ON r."Id" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r3."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST +SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +INNER JOIN "OptionalRelated_NestedCollection" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" """); } } - #endregion Subquery + #endregion Collection - #region SelectMany + #region Multiple - public override async Task SelectMany_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_trunk_collection(async, queryTrackingBehavior); + await base.Select_root_duplicated(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", r."Id", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkId1", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsBranchId1", s."Id10", s."Name0", s."OptionalReferenceLeaf_Name", s."RequiredReferenceLeaf_Name", r0."OptionalReferenceBranch_Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkId1", r3."Id1", r3."Name", r0."OptionalReferenceBranch_OptionalReferenceLeaf_Name", r0."OptionalReferenceBranch_RequiredReferenceLeaf_Name", r0."RequiredReferenceBranch_Name", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkId1", r4."Id1", r4."Name", r0."RequiredReferenceBranch_OptionalReferenceLeaf_Name", r0."RequiredReferenceBranch_RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "Root_CollectionTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String", o3."RelatedTypeRootEntityId", o3."Id", o3."Int", o3."Name", o3."String", s0."RootEntityId", s0."Id", s0."Int", s0."Name", s0."String", s0."RelatedTypeRootEntityId", s0."RelatedTypeId", s0."RelatedTypeRootEntityId0", s0."RelatedTypeId0", s0."RelatedTypeRootEntityId1", s0."RelatedTypeId1", s0."Id0", s0."Int0", s0."Name0", s0."String0", s0."Id1", s0."Int1", s0."Name1", s0."String1", s0."Id2", s0."Int2", s0."Name2", s0."String2", r12."RelatedTypeRootEntityId", r12."Id", r12."Int", r12."Name", r12."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o3 ON o."RootEntityId" = o3."RelatedTypeRootEntityId" LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r2."RelationshipsBranchId1", r2."Id1" AS "Id10", r2."Name" AS "Name0", r1."OptionalReferenceLeaf_Name", r1."RequiredReferenceLeaf_Name" - FROM "Root_CollectionTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_CollectionLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" AND r1."Id1" = r2."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r3 ON CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."RelationshipsRootId" -END = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND CASE - WHEN r0."OptionalReferenceBranch_Name" IS NOT NULL THEN r0."Id1" -END = r3."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsBranchRelationshipsTrunkId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r0."Id1" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkId1" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."Id10" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, r3."Id1" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST + SELECT r8."RootEntityId", r8."Id", r8."Int", r8."Name", r8."String", r9."RelatedTypeRootEntityId", r9."RelatedTypeId", r10."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r10."RelatedTypeId" AS "RelatedTypeId0", r11."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r11."RelatedTypeId" AS "RelatedTypeId1", r11."Id" AS "Id0", r11."Int" AS "Int0", r11."Name" AS "Name0", r11."String" AS "String0", r9."Id" AS "Id1", r9."Int" AS "Int1", r9."Name" AS "Name1", r9."String" AS "String1", r10."Id" AS "Id2", r10."Int" AS "Int2", r10."Name" AS "Name2", r10."String" AS "String2" + FROM "RelatedCollection" AS r8 + LEFT JOIN "RelatedCollection_OptionalNested" AS r9 ON r8."RootEntityId" = r9."RelatedTypeRootEntityId" AND r8."Id" = r9."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r10 ON r8."RootEntityId" = r10."RelatedTypeRootEntityId" AND r8."Id" = r10."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r11 ON r8."RootEntityId" = r11."RelatedTypeRootEntityId" AND r8."Id" = r11."RelatedTypeId" +) AS s0 ON r."Id" = s0."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r12 ON r0."RootEntityId" = r12."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST, r7."Id" NULLS FIRST, o3."RelatedTypeRootEntityId" NULLS FIRST, o3."Id" NULLS FIRST, s0."RootEntityId" NULLS FIRST, s0."Id" NULLS FIRST, s0."RelatedTypeRootEntityId" NULLS FIRST, s0."RelatedTypeId" NULLS FIRST, s0."RelatedTypeRootEntityId0" NULLS FIRST, s0."RelatedTypeId0" NULLS FIRST, s0."RelatedTypeRootEntityId1" NULLS FIRST, s0."RelatedTypeId1" NULLS FIRST, s0."Id0" NULLS FIRST, r12."RelatedTypeRootEntityId" NULLS FIRST """); - } } - public override async Task SelectMany_required_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_required_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."Id", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1", r1."Name", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "Root_RequiredReferenceTrunk_CollectionBranch" AS r0 ON r."Id" = r0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r0."Id1" NULLS FIRST, r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."RelationshipsBranchId1" NULLS FIRST +SELECT s."RelatedTypeRootEntityId", s."Id", s."Int", s."Name", s."String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String" + FROM "RootEntity" AS r0 + LEFT JOIN "RequiredRelated" AS r1 ON r0."Id" = r1."RootEntityId" + LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r1."RootEntityId" = r2."RelatedTypeRootEntityId" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS s ON TRUE """); } } - public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_optional_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RelationshipsTrunkRelationshipsRootId", r0."Id1", r0."Name", r."Id", r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r1."RelationshipsBranchId1", r1."Id1", r1."Name", r0."OptionalReferenceLeaf_Name", r0."RequiredReferenceLeaf_Name" -FROM "RootEntities" AS r -INNER JOIN "Root_OptionalReferenceTrunk_CollectionBranch" AS r0 ON CASE - WHEN r."OptionalReferenceTrunk_Name" IS NOT NULL THEN r."Id" -END = r0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r1 ON r0."RelationshipsTrunkRelationshipsRootId" = r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsBranchId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r0."Id1" NULLS FIRST, r1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."RelationshipsBranchId1" NULLS FIRST +SELECT s."RelatedTypeRootEntityId", s."Id", s."Int", s."Name", s."String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String" + FROM "RootEntity" AS r0 + LEFT JOIN "OptionalRelated" AS o ON r0."Id" = o."RootEntityId" + LEFT JOIN "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS s ON TRUE """); } } - #endregion SelectMany + #endregion Subquery [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs new file mode 100644 index 0000000000..a7272498e1 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs @@ -0,0 +1,124 @@ +// 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.Relationships.OwnedNavigations; + +public class OwnedNavigationsSetOperationsNpgsqlTest( + OwnedNavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task On_related() + { + await base.On_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r2."Id", r2."Int", r2."Name", r2."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Name", r9."String", r3."Id", r3."Int", r3."Name", r3."String", r4."Id", r4."Int", r4."Name", r4."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r2 ON r."Id" = r2."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r3 ON r2."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r2."RootEntityId" = r4."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Name", r5."String", r6."RelatedTypeRootEntityId", r6."RelatedTypeId", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r7."RelatedTypeId" AS "RelatedTypeId0", r8."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r8."RelatedTypeId" AS "RelatedTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Name" AS "Name2", r7."String" AS "String2" + FROM "RelatedCollection" AS r5 + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."RelatedTypeRootEntityId" AND r5."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."RelatedTypeRootEntityId" AND r5."Id" = r7."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."RelatedTypeRootEntityId" AND r5."Id" = r8."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."RelatedTypeRootEntityId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" AND r0."Int" = 8 + UNION ALL + SELECT 1 + FROM "RelatedCollection" AS r1 + WHERE r."Id" = r1."RootEntityId" AND r1."String" = 'foo' + ) AS u) = 4 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r2."RootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, r4."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r9."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) + => Assert.ThrowsAnyAsync(() => base.On_related_projected(queryTrackingBehavior)); + + public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + { + await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(sum(( + SELECT COALESCE(sum(r2."Int"), 0)::int + FROM "RelatedCollection_NestedCollection" AS r2 + WHERE u."RootEntityId" = r2."RelatedTypeRootEntityId" AND u."Id" = r2."RelatedTypeId")), 0)::int + FROM ( + SELECT r0."RootEntityId", r0."Id" + FROM "RelatedCollection" AS r0 + WHERE r."Id" = r0."RootEntityId" AND r0."Int" = 8 + UNION ALL + SELECT r1."RootEntityId", r1."Id" + FROM "RelatedCollection" AS r1 + WHERE r."Id" = r1."RootEntityId" AND r1."String" = 'foo' + ) AS u) +FROM "RootEntity" AS r +"""); + } + + public override async Task On_nested() + { + await base.On_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Name", r9."String", r3."Id", r3."Int", r3."Name", r3."String", r4."Id", r4."Int", r4."Name", r4."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r3 ON r0."RootEntityId" = r3."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r0."RootEntityId" = r4."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Name", r5."String", r6."RelatedTypeRootEntityId", r6."RelatedTypeId", r7."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r7."RelatedTypeId" AS "RelatedTypeId0", r8."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r8."RelatedTypeId" AS "RelatedTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Name" AS "Name2", r7."String" AS "String2" + FROM "RelatedCollection" AS r5 + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."RelatedTypeRootEntityId" AND r5."Id" = r6."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."RelatedTypeRootEntityId" AND r5."Id" = r7."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."RelatedTypeRootEntityId" AND r5."Id" = r8."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r0."RootEntityId" = r9."RelatedTypeRootEntityId" +WHERE ( + SELECT count(*)::int + FROM ( + SELECT 1 + FROM "RequiredRelated_NestedCollection" AS r1 + WHERE r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r1."Int" = 8 + UNION ALL + SELECT 1 + FROM "RequiredRelated_NestedCollection" AS r2 + WHERE r0."RootEntityId" = r2."RelatedTypeRootEntityId" AND r2."String" = 'foo' + ) AS u) = 4 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r3."RelatedTypeRootEntityId" NULLS FIRST, r4."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r9."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Over_different_collection_properties() + { + await base.Over_different_collection_properties(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..33791c6b02 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,241 @@ +// 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.Relationships.OwnedNavigations; + +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedNavigationsStructuralEqualityNpgsqlTest( + OwnedNavigationsNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o1."Id", o1."Int", o1."Name", o1."String", o0."Id", o0."Int", o0."Name", o0."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r2."Id", r2."Int", r2."Name", r2."String", r1."Id", r1."Int", r1."Name", r1."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE o."RootEntityId" IS NULL +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE o."RootEntityId" IS NULL +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE r1."RelatedTypeRootEntityId" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql( + ); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Name", o2."String", o0."Id", o0."Int", o0."Name", o0."String", o1."Id", o1."Int", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Name0", s."String0", s."Id1", s."Int1", s."Name1", s."String1", s."Id2", s."Int2", s."Name2", s."String2", r0."Id", r0."Int", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Name", r7."String", r1."Id", r1."Int", r1."Name", r1."String", r2."Id", r2."Int", r2."Name", r2."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated" AS o ON r."Id" = o."RootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r5."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId0", r5."RelatedTypeId" AS "RelatedTypeId0", r6."RelatedTypeRootEntityId" AS "RelatedTypeRootEntityId1", r6."RelatedTypeId" AS "RelatedTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Name" AS "Name2", r5."String" AS "String2" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."RelatedTypeRootEntityId" AND r3."Id" = r5."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."RelatedTypeRootEntityId" AND r3."Id" = r6."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o1."RelatedTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, o2."RelatedTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."RelatedTypeRootEntityId0" NULLS FIRST, s."RelatedTypeId0" NULLS FIRST, s."RelatedTypeRootEntityId1" NULLS FIRST, s."RelatedTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, r7."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs new file mode 100644 index 0000000000..1b73aae1c0 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs @@ -0,0 +1,85 @@ +// 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.Relationships.OwnedTableSplitting; + +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedTableSplittingMiscellaneousNpgsqlTest( + OwnedTableSplittingNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedTableSplittingMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_related_property() + { + await base.Where_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE r."RequiredRelated_Int" = 8 +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Where_optional_related_property() + { + await base.Where_optional_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE r."OptionalRelated_Int" = 8 +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Where_nested_related_property() + { + await base.Where_nested_related_property(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE r."RequiredRelated_RequiredNested_Int" = 8 +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingNpgsqlFixture.cs new file mode 100644 index 0000000000..58e2bb8be7 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingNpgsqlFixture.cs @@ -0,0 +1,10 @@ +// 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.Relationships.OwnedTableSplitting; + +public class OwnedTableSplittingNpgsqlFixture : OwnedTableSplittingRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => NpgsqlTestStoreFactory.Instance; +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs index d1f6b5573a..c86a12b510 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs @@ -1,1013 +1,378 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedTableSplitting; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -public class OwnedTableSplittingProjectionNpgsqlTest - : OwnedTableSplittingProjectionRelationalTestBase -{ - public OwnedTableSplittingProjectionNpgsqlTest(OwnedTableSplittingRelationshipsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) - { - Fixture.TestSqlLoggerFactory.Clear(); - Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); - } +namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedTableSplitting; - public override async Task Select_root(bool async, QueryTrackingBehavior queryTrackingBehavior) +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedTableSplittingProjectionNpgsqlTest(OwnedTableSplittingNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root(async, queryTrackingBehavior); + await base.Select_root(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r0."RelationshipsRootId", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."RelationshipsRootId", r8."RelationshipsTrunkRelationshipsRootId", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsTrunkRelationshipsRootId", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."RelationshipsTrunkRelationshipsRootId0", s0."RelationshipsTrunkId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s0."RelationshipsBranchRelationshipsTrunkId12", s0."RelationshipsTrunkRelationshipsRootId1", s0."RelationshipsTrunkId11", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s0."RelationshipsBranchRelationshipsTrunkId13", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s0."RelationshipsBranchRelationshipsTrunkId100", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s0."RelationshipsBranchRelationshipsTrunkId110", s0."RelationshipsBranchId11", s0."Id100", s0."Name00", s0."Name1", s0."Name2", s0."Name3", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s0."RelationshipsBranchRelationshipsTrunkId14", s0."Id11", s0."Name4", s0."Name5", s0."Name6", s0."Name7", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s0."RelationshipsBranchRelationshipsTrunkId15", s0."Id12", s0."Name8", s0."Name9", s0."Name10", r0."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchId11", s1."Id10", s1."Name0", s1."Name1", s1."Name2", r1."Name", r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r31."Id1", r31."Name", r2."Name", r3."Name", r4."Name", r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r32."Id1", r32."Name", r5."Name", r6."Name", r7."Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s2."RelationshipsBranchId10", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s2."RelationshipsBranchId11", s2."Id10", s2."Name0", s2."Name1", s2."Name2", r8."Name", r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r37."Id1", r37."Name", r9."Name", r10."Name", r11."Name", r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r38."Id1", r38."Name", r12."Name", r13."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk" AS r7 ON r."Id" = r7."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r8 ON r7."RelationshipsRootId" = r8."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r9 ON r8."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r10 ON r8."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r11 ON r7."RelationshipsRootId" = r11."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r12 ON r11."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r13 ON r11."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsTrunkRelationshipsRootId", r15."RelationshipsTrunkId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r16."RelationshipsBranchRelationshipsTrunkId1", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r17."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r18."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r18."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r19."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r20."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s."RelationshipsBranchId11", s."Id10" AS "Id100", s."Name0" AS "Name00", s."Name1", s."Name2", r15."Name" AS "Name3", r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r25."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r25."Id1" AS "Id11", r25."Name" AS "Name4", r16."Name" AS "Name5", r17."Name" AS "Name6", r18."Name" AS "Name7", r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r26."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r26."Id1" AS "Id12", r26."Name" AS "Name8", r19."Name" AS "Name9", r20."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r14 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r15 ON r14."RelationshipsRootId" = r15."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r16 ON r15."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r16."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r17 ON r15."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r17."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r18 ON r14."RelationshipsRootId" = r18."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r18."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r19 ON r18."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r19."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r20 ON r18."RelationshipsTrunkRelationshipsRootId" = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r20."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r21."RelationshipsTrunkRelationshipsRootId", r21."RelationshipsTrunkId1", r21."Id1", r21."Name", r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r22."RelationshipsBranchRelationshipsTrunkId1", r22."RelationshipsBranchId1", r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r23."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r23."RelationshipsBranchId1" AS "RelationshipsBranchId10", r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r24."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r24."RelationshipsBranchId1" AS "RelationshipsBranchId11", r24."Id1" AS "Id10", r24."Name" AS "Name0", r22."Name" AS "Name1", r23."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r21 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r22 ON r21."RelationshipsTrunkRelationshipsRootId" = r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r22."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r22."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r23 ON r21."RelationshipsTrunkRelationshipsRootId" = r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r23."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r23."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r24 ON r21."RelationshipsTrunkRelationshipsRootId" = r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r24."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r24."RelationshipsBranchId1" - ) AS s ON r14."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r25 ON r15."RelationshipsTrunkRelationshipsRootId" = r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r25."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r26 ON r18."RelationshipsTrunkRelationshipsRootId" = r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r26."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -LEFT JOIN ( - SELECT r27."RelationshipsTrunkRelationshipsRootId", r27."Id1", r27."Name", r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r28."RelationshipsBranchId1", r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r29."RelationshipsBranchId1" AS "RelationshipsBranchId10", r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r30."RelationshipsBranchId1" AS "RelationshipsBranchId11", r30."Id1" AS "Id10", r30."Name" AS "Name0", r28."Name" AS "Name1", r29."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r27 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r28 ON r27."RelationshipsTrunkRelationshipsRootId" = r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r28."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r29 ON r27."RelationshipsTrunkRelationshipsRootId" = r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r29."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r30 ON r27."RelationshipsTrunkRelationshipsRootId" = r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r30."RelationshipsBranchId1" -) AS s1 ON r0."RelationshipsRootId" = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r31 ON r1."RelationshipsTrunkRelationshipsRootId" = r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r32 ON r4."RelationshipsTrunkRelationshipsRootId" = r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r33."RelationshipsTrunkRelationshipsRootId", r33."Id1", r33."Name", r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r34."RelationshipsBranchId1", r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r35."RelationshipsBranchId1" AS "RelationshipsBranchId10", r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r36."RelationshipsBranchId1" AS "RelationshipsBranchId11", r36."Id1" AS "Id10", r36."Name" AS "Name0", r34."Name" AS "Name1", r35."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r33 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r34 ON r33."RelationshipsTrunkRelationshipsRootId" = r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r34."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r35 ON r33."RelationshipsTrunkRelationshipsRootId" = r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r35."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r36 ON r33."RelationshipsTrunkRelationshipsRootId" = r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r36."RelationshipsBranchId1" -) AS s2 ON r7."RelationshipsRootId" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r37 ON r8."RelationshipsTrunkRelationshipsRootId" = r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r38 ON r11."RelationshipsTrunkRelationshipsRootId" = r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."RelationshipsRootId" NULLS FIRST, r8."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsTrunkId11" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s0."Id12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchId11" NULLS FIRST, s1."Id10" NULLS FIRST, r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r31."Id1" NULLS FIRST, r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r32."Id1" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s2."RelationshipsBranchId10" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s2."RelationshipsBranchId11" NULLS FIRST, s2."Id10" NULLS FIRST, r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r37."Id1" NULLS FIRST, r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST """); } - public override async Task Select_trunk_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + #region Simple properties + + public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_optional(async, queryTrackingBehavior); + await base.Select_property_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r0."RelationshipsRootId", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r1."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r2."Name", r3."Name", r4."Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r5."Name", r6."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r10."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT r."RequiredRelated_String" +FROM "RootEntity" AS r """); - } } - public override async Task Select_trunk_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_required(async, queryTrackingBehavior); + await base.Select_property_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r0."RelationshipsRootId", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r1."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r2."Name", r3."Name", r4."Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r5."Name", r6."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r10."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT r."OptionalRelated_String" +FROM "RootEntity" AS r """); - } } - public override async Task Select_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_collection(async, queryTrackingBehavior); + await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r."Id", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."RelationshipsTrunkRelationshipsRootId0", s0."RelationshipsTrunkId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s0."RelationshipsBranchRelationshipsTrunkId12", s0."RelationshipsTrunkRelationshipsRootId1", s0."RelationshipsTrunkId11", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s0."RelationshipsBranchRelationshipsTrunkId13", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s0."RelationshipsBranchRelationshipsTrunkId100", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s0."RelationshipsBranchRelationshipsTrunkId110", s0."RelationshipsBranchId11", s0."Id100", s0."Name00", s0."Name1", s0."Name2", s0."Name3", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s0."RelationshipsBranchRelationshipsTrunkId14", s0."Id11", s0."Name4", s0."Name5", s0."Name6", s0."Name7", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s0."RelationshipsBranchRelationshipsTrunkId15", s0."Id12", s0."Name8", s0."Name9", s0."Name10" -FROM "RelationshipsRoot" AS r -LEFT JOIN ( - SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r4."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r4."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r5."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r6."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s."RelationshipsBranchId11", s."Id10" AS "Id100", s."Name0" AS "Name00", s."Name1", s."Name2", r1."Name" AS "Name3", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r11."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r11."Id1" AS "Id11", r11."Name" AS "Name4", r2."Name" AS "Name5", r3."Name" AS "Name6", r4."Name" AS "Name7", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r12."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r12."Id1" AS "Id12", r12."Name" AS "Name8", r5."Name" AS "Name9", r6."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r0 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r3."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r5."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r6."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."RelationshipsTrunkId1", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchRelationshipsTrunkId1", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r8."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r9."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r10."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r10."RelationshipsBranchId1" - ) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r11."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r12."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsTrunkId11" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST + AssertSql( + """ +SELECT r."OptionalRelated_Int" +FROM "RootEntity" AS r """); - } } - public override async Task Select_branch_required_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_required(async, queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST + AssertSql( + """ +SELECT r."OptionalRelated_Int" +FROM "RootEntity" AS r """); - } } - public override async Task Select_branch_required_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_branch_required_optional(async, queryTrackingBehavior); + #endregion Simple properties - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST -"""); - } - } + #region Non-collection - public override async Task Select_branch_optional_required(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_required(async, queryTrackingBehavior); + await base.Select_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_branch_optional_optional(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_optional(async, queryTrackingBehavior); + await base.Select_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_branch_required_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_required_collection(async, queryTrackingBehavior); + await base.Select_required_nested_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchId1" AS "RelationshipsBranchId10", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r4."RelationshipsBranchId1" AS "RelationshipsBranchId11", r4."Id1" AS "Id10", r4."Name" AS "Name0", r2."Name" AS "Name1", r3."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r3."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r4."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST +SELECT r."Id", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r """); } } - public override async Task Select_branch_optional_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_branch_optional_collection(async, queryTrackingBehavior); + await base.Select_optional_nested_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN ( - SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r3."RelationshipsBranchId1" AS "RelationshipsBranchId10", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r4."RelationshipsBranchId1" AS "RelationshipsBranchId11", r4."Id1" AS "Id10", r4."Name" AS "Name0", r2."Name" AS "Name1", r3."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r3."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r4."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST +SELECT r."Id", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String" +FROM "RootEntity" AS r """); } } - #region Multiple - - public override async Task Select_root_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root_duplicated(async, queryTrackingBehavior); + await base.Select_required_nested_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql( - """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r0."RelationshipsRootId", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."RelationshipsRootId", r8."RelationshipsTrunkRelationshipsRootId", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsTrunkRelationshipsRootId", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."RelationshipsTrunkRelationshipsRootId0", s0."RelationshipsTrunkId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s0."RelationshipsBranchRelationshipsTrunkId12", s0."RelationshipsTrunkRelationshipsRootId1", s0."RelationshipsTrunkId11", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s0."RelationshipsBranchRelationshipsTrunkId13", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s0."RelationshipsBranchRelationshipsTrunkId100", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s0."RelationshipsBranchRelationshipsTrunkId110", s0."RelationshipsBranchId11", s0."Id100", s0."Name00", s0."Name1", s0."Name2", s0."Name3", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s0."RelationshipsBranchRelationshipsTrunkId14", s0."Id11", s0."Name4", s0."Name5", s0."Name6", s0."Name7", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s0."RelationshipsBranchRelationshipsTrunkId15", s0."Id12", s0."Name8", s0."Name9", s0."Name10", r0."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchId11", s1."Id10", s1."Name0", s1."Name1", s1."Name2", r1."Name", r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r31."Id1", r31."Name", r2."Name", r3."Name", r4."Name", r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r32."Id1", r32."Name", r5."Name", r6."Name", r7."Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s2."RelationshipsBranchId10", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s2."RelationshipsBranchId11", s2."Id10", s2."Name0", s2."Name1", s2."Name2", r8."Name", r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r37."Id1", r37."Name", r9."Name", r10."Name", r11."Name", r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r38."Id1", r38."Name", r12."Name", r13."Name", s4."RelationshipsRootId", s4."Id1", s4."Name", s4."RelationshipsTrunkRelationshipsRootId", s4."RelationshipsTrunkId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s4."RelationshipsBranchRelationshipsTrunkId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s4."RelationshipsBranchRelationshipsTrunkId10", s4."RelationshipsTrunkRelationshipsRootId0", s4."RelationshipsTrunkId10", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s4."RelationshipsBranchRelationshipsTrunkId11", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s4."RelationshipsBranchRelationshipsTrunkId12", s4."RelationshipsTrunkRelationshipsRootId1", s4."RelationshipsTrunkId11", s4."Id10", s4."Name0", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s4."RelationshipsBranchRelationshipsTrunkId13", s4."RelationshipsBranchId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s4."RelationshipsBranchRelationshipsTrunkId100", s4."RelationshipsBranchId10", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s4."RelationshipsBranchRelationshipsTrunkId110", s4."RelationshipsBranchId11", s4."Id100", s4."Name00", s4."Name1", s4."Name2", s4."Name3", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s4."RelationshipsBranchRelationshipsTrunkId14", s4."Id11", s4."Name4", s4."Name5", s4."Name6", s4."Name7", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s4."RelationshipsBranchRelationshipsTrunkId15", s4."Id12", s4."Name8", s4."Name9", s4."Name10", s5."RelationshipsTrunkRelationshipsRootId", s5."Id1", s5."Name", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s5."RelationshipsBranchId1", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s5."RelationshipsBranchId10", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s5."RelationshipsBranchId11", s5."Id10", s5."Name0", s5."Name1", s5."Name2", r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r56."Id1", r56."Name", r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r57."Id1", r57."Name", s6."RelationshipsTrunkRelationshipsRootId", s6."Id1", s6."Name", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s6."RelationshipsBranchId1", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s6."RelationshipsBranchId10", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s6."RelationshipsBranchId11", s6."Id10", s6."Name0", s6."Name1", s6."Name2", r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r62."Id1", r62."Name", r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r63."Id1", r63."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk" AS r7 ON r."Id" = r7."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r8 ON r7."RelationshipsRootId" = r8."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r9 ON r8."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r10 ON r8."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r11 ON r7."RelationshipsRootId" = r11."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r12 ON r11."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r13 ON r11."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsTrunkRelationshipsRootId", r15."RelationshipsTrunkId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r16."RelationshipsBranchRelationshipsTrunkId1", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r17."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r18."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r18."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r19."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r20."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s."RelationshipsBranchId11", s."Id10" AS "Id100", s."Name0" AS "Name00", s."Name1", s."Name2", r15."Name" AS "Name3", r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r25."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r25."Id1" AS "Id11", r25."Name" AS "Name4", r16."Name" AS "Name5", r17."Name" AS "Name6", r18."Name" AS "Name7", r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r26."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r26."Id1" AS "Id12", r26."Name" AS "Name8", r19."Name" AS "Name9", r20."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r14 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r15 ON r14."RelationshipsRootId" = r15."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r16 ON r15."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r16."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r17 ON r15."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r17."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r18 ON r14."RelationshipsRootId" = r18."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r18."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r19 ON r18."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r19."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r20 ON r18."RelationshipsTrunkRelationshipsRootId" = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r20."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r21."RelationshipsTrunkRelationshipsRootId", r21."RelationshipsTrunkId1", r21."Id1", r21."Name", r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r22."RelationshipsBranchRelationshipsTrunkId1", r22."RelationshipsBranchId1", r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r23."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r23."RelationshipsBranchId1" AS "RelationshipsBranchId10", r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r24."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r24."RelationshipsBranchId1" AS "RelationshipsBranchId11", r24."Id1" AS "Id10", r24."Name" AS "Name0", r22."Name" AS "Name1", r23."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r21 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r22 ON r21."RelationshipsTrunkRelationshipsRootId" = r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r22."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r22."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r23 ON r21."RelationshipsTrunkRelationshipsRootId" = r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r23."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r23."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r24 ON r21."RelationshipsTrunkRelationshipsRootId" = r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r24."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r24."RelationshipsBranchId1" - ) AS s ON r14."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r25 ON r15."RelationshipsTrunkRelationshipsRootId" = r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r25."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r26 ON r18."RelationshipsTrunkRelationshipsRootId" = r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r26."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -LEFT JOIN ( - SELECT r27."RelationshipsTrunkRelationshipsRootId", r27."Id1", r27."Name", r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r28."RelationshipsBranchId1", r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r29."RelationshipsBranchId1" AS "RelationshipsBranchId10", r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r30."RelationshipsBranchId1" AS "RelationshipsBranchId11", r30."Id1" AS "Id10", r30."Name" AS "Name0", r28."Name" AS "Name1", r29."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r27 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r28 ON r27."RelationshipsTrunkRelationshipsRootId" = r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r28."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r29 ON r27."RelationshipsTrunkRelationshipsRootId" = r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r29."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r30 ON r27."RelationshipsTrunkRelationshipsRootId" = r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r30."RelationshipsBranchId1" -) AS s1 ON r0."RelationshipsRootId" = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r31 ON r1."RelationshipsTrunkRelationshipsRootId" = r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r32 ON r4."RelationshipsTrunkRelationshipsRootId" = r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r33."RelationshipsTrunkRelationshipsRootId", r33."Id1", r33."Name", r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r34."RelationshipsBranchId1", r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r35."RelationshipsBranchId1" AS "RelationshipsBranchId10", r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r36."RelationshipsBranchId1" AS "RelationshipsBranchId11", r36."Id1" AS "Id10", r36."Name" AS "Name0", r34."Name" AS "Name1", r35."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r33 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r34 ON r33."RelationshipsTrunkRelationshipsRootId" = r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r34."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r35 ON r33."RelationshipsTrunkRelationshipsRootId" = r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r35."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r36 ON r33."RelationshipsTrunkRelationshipsRootId" = r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r36."RelationshipsBranchId1" -) AS s2 ON r7."RelationshipsRootId" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r37 ON r8."RelationshipsTrunkRelationshipsRootId" = r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r38 ON r11."RelationshipsTrunkRelationshipsRootId" = r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r39."RelationshipsRootId", r39."Id1", r39."Name", r40."RelationshipsTrunkRelationshipsRootId", r40."RelationshipsTrunkId1", r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r41."RelationshipsBranchRelationshipsTrunkId1", r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r42."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r43."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r43."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r44."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r45."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r45."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s3."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s3."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s3."Id1" AS "Id10", s3."Name" AS "Name0", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s3."RelationshipsBranchId1", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s3."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s3."RelationshipsBranchId10", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s3."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s3."RelationshipsBranchId11", s3."Id10" AS "Id100", s3."Name0" AS "Name00", s3."Name1", s3."Name2", r40."Name" AS "Name3", r50."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r50."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r50."Id1" AS "Id11", r50."Name" AS "Name4", r41."Name" AS "Name5", r42."Name" AS "Name6", r43."Name" AS "Name7", r51."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r51."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r51."Id1" AS "Id12", r51."Name" AS "Name8", r44."Name" AS "Name9", r45."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r39 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r40 ON r39."RelationshipsRootId" = r40."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r40."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r41 ON r40."RelationshipsTrunkRelationshipsRootId" = r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r41."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r42 ON r40."RelationshipsTrunkRelationshipsRootId" = r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r42."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r43 ON r39."RelationshipsRootId" = r43."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r43."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r44 ON r43."RelationshipsTrunkRelationshipsRootId" = r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r44."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r45 ON r43."RelationshipsTrunkRelationshipsRootId" = r45."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r45."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r46."RelationshipsTrunkRelationshipsRootId", r46."RelationshipsTrunkId1", r46."Id1", r46."Name", r47."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r47."RelationshipsBranchRelationshipsTrunkId1", r47."RelationshipsBranchId1", r48."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r48."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r48."RelationshipsBranchId1" AS "RelationshipsBranchId10", r49."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r49."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r49."RelationshipsBranchId1" AS "RelationshipsBranchId11", r49."Id1" AS "Id10", r49."Name" AS "Name0", r47."Name" AS "Name1", r48."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r46 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r47 ON r46."RelationshipsTrunkRelationshipsRootId" = r47."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r47."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r47."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r48 ON r46."RelationshipsTrunkRelationshipsRootId" = r48."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r48."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r48."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r49 ON r46."RelationshipsTrunkRelationshipsRootId" = r49."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r49."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r49."RelationshipsBranchId1" - ) AS s3 ON r39."RelationshipsRootId" = s3."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = s3."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r50 ON r40."RelationshipsTrunkRelationshipsRootId" = r50."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r50."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r51 ON r43."RelationshipsTrunkRelationshipsRootId" = r51."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r51."RelationshipsBranchRelationshipsTrunkId1" -) AS s4 ON r."Id" = s4."RelationshipsRootId" -LEFT JOIN ( - SELECT r52."RelationshipsTrunkRelationshipsRootId", r52."Id1", r52."Name", r53."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r53."RelationshipsBranchId1", r54."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r54."RelationshipsBranchId1" AS "RelationshipsBranchId10", r55."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r55."RelationshipsBranchId1" AS "RelationshipsBranchId11", r55."Id1" AS "Id10", r55."Name" AS "Name0", r53."Name" AS "Name1", r54."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r52 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r53 ON r52."RelationshipsTrunkRelationshipsRootId" = r53."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r53."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r54 ON r52."RelationshipsTrunkRelationshipsRootId" = r54."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r54."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r55 ON r52."RelationshipsTrunkRelationshipsRootId" = r55."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r55."RelationshipsBranchId1" -) AS s5 ON r0."RelationshipsRootId" = s5."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r56 ON r1."RelationshipsTrunkRelationshipsRootId" = r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r57 ON r4."RelationshipsTrunkRelationshipsRootId" = r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r58."RelationshipsTrunkRelationshipsRootId", r58."Id1", r58."Name", r59."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r59."RelationshipsBranchId1", r60."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r60."RelationshipsBranchId1" AS "RelationshipsBranchId10", r61."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r61."RelationshipsBranchId1" AS "RelationshipsBranchId11", r61."Id1" AS "Id10", r61."Name" AS "Name0", r59."Name" AS "Name1", r60."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r58 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r59 ON r58."RelationshipsTrunkRelationshipsRootId" = r59."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r59."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r60 ON r58."RelationshipsTrunkRelationshipsRootId" = r60."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r60."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r61 ON r58."RelationshipsTrunkRelationshipsRootId" = r61."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r61."RelationshipsBranchId1" -) AS s6 ON r7."RelationshipsRootId" = s6."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r62 ON r8."RelationshipsTrunkRelationshipsRootId" = r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r63 ON r11."RelationshipsTrunkRelationshipsRootId" = r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."RelationshipsRootId" NULLS FIRST, r8."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsTrunkId11" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s0."Id12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchId11" NULLS FIRST, s1."Id10" NULLS FIRST, r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r31."Id1" NULLS FIRST, r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r32."Id1" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s2."RelationshipsBranchId10" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s2."RelationshipsBranchId11" NULLS FIRST, s2."Id10" NULLS FIRST, r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r37."Id1" NULLS FIRST, r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r38."Id1" NULLS FIRST, s4."RelationshipsRootId" NULLS FIRST, s4."Id1" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsTrunkId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s4."RelationshipsTrunkId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s4."RelationshipsTrunkId11" NULLS FIRST, s4."Id10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s4."RelationshipsBranchId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s4."RelationshipsBranchId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s4."RelationshipsBranchId11" NULLS FIRST, s4."Id100" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s4."Id11" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s4."Id12" NULLS FIRST, s5."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."Id1" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."RelationshipsBranchId1" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s5."RelationshipsBranchId10" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s5."RelationshipsBranchId11" NULLS FIRST, s5."Id10" NULLS FIRST, r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r56."Id1" NULLS FIRST, r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r57."Id1" NULLS FIRST, s6."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."Id1" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."RelationshipsBranchId1" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s6."RelationshipsBranchId10" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s6."RelationshipsBranchId11" NULLS FIRST, s6."Id10" NULLS FIRST, r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r62."Id1" NULLS FIRST, r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST -"""); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", r0."RelationshipsRootId", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."RelationshipsRootId", r8."RelationshipsTrunkRelationshipsRootId", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsTrunkRelationshipsRootId", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."RelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchRelationshipsTrunkId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchRelationshipsTrunkId10", s0."RelationshipsTrunkRelationshipsRootId0", s0."RelationshipsTrunkId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchRelationshipsTrunkId11", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s0."RelationshipsBranchRelationshipsTrunkId12", s0."RelationshipsTrunkRelationshipsRootId1", s0."RelationshipsTrunkId11", s0."Id10", s0."Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s0."RelationshipsBranchRelationshipsTrunkId13", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s0."RelationshipsBranchRelationshipsTrunkId100", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s0."RelationshipsBranchRelationshipsTrunkId110", s0."RelationshipsBranchId11", s0."Id100", s0."Name00", s0."Name1", s0."Name2", s0."Name3", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s0."RelationshipsBranchRelationshipsTrunkId14", s0."Id11", s0."Name4", s0."Name5", s0."Name6", s0."Name7", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s0."RelationshipsBranchRelationshipsTrunkId15", s0."Id12", s0."Name8", s0."Name9", s0."Name10", r0."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchId11", s1."Id10", s1."Name0", s1."Name1", s1."Name2", r1."Name", r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r31."Id1", r31."Name", r2."Name", r3."Name", r4."Name", r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r32."Id1", r32."Name", r5."Name", r6."Name", r7."Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s2."RelationshipsBranchId10", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s2."RelationshipsBranchId11", s2."Id10", s2."Name0", s2."Name1", s2."Name2", r8."Name", r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r37."Id1", r37."Name", r9."Name", r10."Name", r11."Name", r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r38."Id1", r38."Name", r12."Name", r13."Name", s4."RelationshipsRootId", s4."Id1", s4."Name", s4."RelationshipsTrunkRelationshipsRootId", s4."RelationshipsTrunkId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s4."RelationshipsBranchRelationshipsTrunkId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s4."RelationshipsBranchRelationshipsTrunkId10", s4."RelationshipsTrunkRelationshipsRootId0", s4."RelationshipsTrunkId10", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s4."RelationshipsBranchRelationshipsTrunkId11", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s4."RelationshipsBranchRelationshipsTrunkId12", s4."RelationshipsTrunkRelationshipsRootId1", s4."RelationshipsTrunkId11", s4."Id10", s4."Name0", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s4."RelationshipsBranchRelationshipsTrunkId13", s4."RelationshipsBranchId1", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s4."RelationshipsBranchRelationshipsTrunkId100", s4."RelationshipsBranchId10", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s4."RelationshipsBranchRelationshipsTrunkId110", s4."RelationshipsBranchId11", s4."Id100", s4."Name00", s4."Name1", s4."Name2", s4."Name3", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s4."RelationshipsBranchRelationshipsTrunkId14", s4."Id11", s4."Name4", s4."Name5", s4."Name6", s4."Name7", s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s4."RelationshipsBranchRelationshipsTrunkId15", s4."Id12", s4."Name8", s4."Name9", s4."Name10", s5."RelationshipsTrunkRelationshipsRootId", s5."Id1", s5."Name", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s5."RelationshipsBranchId1", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s5."RelationshipsBranchId10", s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s5."RelationshipsBranchId11", s5."Id10", s5."Name0", s5."Name1", s5."Name2", r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r56."Id1", r56."Name", r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r57."Id1", r57."Name", s6."RelationshipsTrunkRelationshipsRootId", s6."Id1", s6."Name", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s6."RelationshipsBranchId1", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s6."RelationshipsBranchId10", s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s6."RelationshipsBranchId11", s6."Id10", s6."Name0", s6."Name1", s6."Name2", r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r62."Id1", r62."Name", r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r63."Id1", r63."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk" AS r7 ON r."Id" = r7."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r8 ON r7."RelationshipsRootId" = r8."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r9 ON r8."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r10 ON r8."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r11 ON r7."RelationshipsRootId" = r11."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r12 ON r11."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r13 ON r11."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsTrunkRelationshipsRootId", r15."RelationshipsTrunkId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r16."RelationshipsBranchRelationshipsTrunkId1", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r17."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r18."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r18."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r19."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r20."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s."Id1" AS "Id10", s."Name" AS "Name0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s."RelationshipsBranchId11", s."Id10" AS "Id100", s."Name0" AS "Name00", s."Name1", s."Name2", r15."Name" AS "Name3", r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r25."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r25."Id1" AS "Id11", r25."Name" AS "Name4", r16."Name" AS "Name5", r17."Name" AS "Name6", r18."Name" AS "Name7", r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r26."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r26."Id1" AS "Id12", r26."Name" AS "Name8", r19."Name" AS "Name9", r20."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r14 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r15 ON r14."RelationshipsRootId" = r15."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r16 ON r15."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r16."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r17 ON r15."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r17."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r18 ON r14."RelationshipsRootId" = r18."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r18."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r19 ON r18."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r19."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r20 ON r18."RelationshipsTrunkRelationshipsRootId" = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r20."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r21."RelationshipsTrunkRelationshipsRootId", r21."RelationshipsTrunkId1", r21."Id1", r21."Name", r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r22."RelationshipsBranchRelationshipsTrunkId1", r22."RelationshipsBranchId1", r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r23."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r23."RelationshipsBranchId1" AS "RelationshipsBranchId10", r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r24."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r24."RelationshipsBranchId1" AS "RelationshipsBranchId11", r24."Id1" AS "Id10", r24."Name" AS "Name0", r22."Name" AS "Name1", r23."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r21 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r22 ON r21."RelationshipsTrunkRelationshipsRootId" = r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r22."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r22."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r23 ON r21."RelationshipsTrunkRelationshipsRootId" = r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r23."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r23."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r24 ON r21."RelationshipsTrunkRelationshipsRootId" = r24."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r24."RelationshipsBranchRelationshipsTrunkId1" AND r21."Id1" = r24."RelationshipsBranchId1" - ) AS s ON r14."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r14."Id1" = s."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r25 ON r15."RelationshipsTrunkRelationshipsRootId" = r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r15."RelationshipsTrunkId1" = r25."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r26 ON r18."RelationshipsTrunkRelationshipsRootId" = r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r18."RelationshipsTrunkId1" = r26."RelationshipsBranchRelationshipsTrunkId1" -) AS s0 ON r."Id" = s0."RelationshipsRootId" -LEFT JOIN ( - SELECT r27."RelationshipsTrunkRelationshipsRootId", r27."Id1", r27."Name", r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r28."RelationshipsBranchId1", r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r29."RelationshipsBranchId1" AS "RelationshipsBranchId10", r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r30."RelationshipsBranchId1" AS "RelationshipsBranchId11", r30."Id1" AS "Id10", r30."Name" AS "Name0", r28."Name" AS "Name1", r29."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r27 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r28 ON r27."RelationshipsTrunkRelationshipsRootId" = r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r28."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r29 ON r27."RelationshipsTrunkRelationshipsRootId" = r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r29."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r30 ON r27."RelationshipsTrunkRelationshipsRootId" = r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."Id1" = r30."RelationshipsBranchId1" -) AS s1 ON r0."RelationshipsRootId" = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r31 ON r1."RelationshipsTrunkRelationshipsRootId" = r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r32 ON r4."RelationshipsTrunkRelationshipsRootId" = r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r33."RelationshipsTrunkRelationshipsRootId", r33."Id1", r33."Name", r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r34."RelationshipsBranchId1", r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r35."RelationshipsBranchId1" AS "RelationshipsBranchId10", r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r36."RelationshipsBranchId1" AS "RelationshipsBranchId11", r36."Id1" AS "Id10", r36."Name" AS "Name0", r34."Name" AS "Name1", r35."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r33 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r34 ON r33."RelationshipsTrunkRelationshipsRootId" = r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r34."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r35 ON r33."RelationshipsTrunkRelationshipsRootId" = r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r35."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r36 ON r33."RelationshipsTrunkRelationshipsRootId" = r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r36."RelationshipsBranchId1" -) AS s2 ON r7."RelationshipsRootId" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r37 ON r8."RelationshipsTrunkRelationshipsRootId" = r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r38 ON r11."RelationshipsTrunkRelationshipsRootId" = r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r39."RelationshipsRootId", r39."Id1", r39."Name", r40."RelationshipsTrunkRelationshipsRootId", r40."RelationshipsTrunkId1", r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r41."RelationshipsBranchRelationshipsTrunkId1", r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r42."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r43."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r43."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r44."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r45."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r45."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s3."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s3."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s3."Id1" AS "Id10", s3."Name" AS "Name0", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s3."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s3."RelationshipsBranchId1", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s3."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s3."RelationshipsBranchId10", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s3."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s3."RelationshipsBranchId11", s3."Id10" AS "Id100", s3."Name0" AS "Name00", s3."Name1", s3."Name2", r40."Name" AS "Name3", r50."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r50."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r50."Id1" AS "Id11", r50."Name" AS "Name4", r41."Name" AS "Name5", r42."Name" AS "Name6", r43."Name" AS "Name7", r51."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r51."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r51."Id1" AS "Id12", r51."Name" AS "Name8", r44."Name" AS "Name9", r45."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r39 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r40 ON r39."RelationshipsRootId" = r40."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r40."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r41 ON r40."RelationshipsTrunkRelationshipsRootId" = r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r41."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r42 ON r40."RelationshipsTrunkRelationshipsRootId" = r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r42."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r43 ON r39."RelationshipsRootId" = r43."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r43."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r44 ON r43."RelationshipsTrunkRelationshipsRootId" = r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r44."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r45 ON r43."RelationshipsTrunkRelationshipsRootId" = r45."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r45."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r46."RelationshipsTrunkRelationshipsRootId", r46."RelationshipsTrunkId1", r46."Id1", r46."Name", r47."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r47."RelationshipsBranchRelationshipsTrunkId1", r47."RelationshipsBranchId1", r48."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r48."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r48."RelationshipsBranchId1" AS "RelationshipsBranchId10", r49."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r49."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r49."RelationshipsBranchId1" AS "RelationshipsBranchId11", r49."Id1" AS "Id10", r49."Name" AS "Name0", r47."Name" AS "Name1", r48."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r46 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r47 ON r46."RelationshipsTrunkRelationshipsRootId" = r47."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r47."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r47."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r48 ON r46."RelationshipsTrunkRelationshipsRootId" = r48."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r48."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r48."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r49 ON r46."RelationshipsTrunkRelationshipsRootId" = r49."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r46."RelationshipsTrunkId1" = r49."RelationshipsBranchRelationshipsTrunkId1" AND r46."Id1" = r49."RelationshipsBranchId1" - ) AS s3 ON r39."RelationshipsRootId" = s3."RelationshipsTrunkRelationshipsRootId" AND r39."Id1" = s3."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r50 ON r40."RelationshipsTrunkRelationshipsRootId" = r50."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r40."RelationshipsTrunkId1" = r50."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r51 ON r43."RelationshipsTrunkRelationshipsRootId" = r51."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r43."RelationshipsTrunkId1" = r51."RelationshipsBranchRelationshipsTrunkId1" -) AS s4 ON r."Id" = s4."RelationshipsRootId" -LEFT JOIN ( - SELECT r52."RelationshipsTrunkRelationshipsRootId", r52."Id1", r52."Name", r53."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r53."RelationshipsBranchId1", r54."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r54."RelationshipsBranchId1" AS "RelationshipsBranchId10", r55."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r55."RelationshipsBranchId1" AS "RelationshipsBranchId11", r55."Id1" AS "Id10", r55."Name" AS "Name0", r53."Name" AS "Name1", r54."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r52 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r53 ON r52."RelationshipsTrunkRelationshipsRootId" = r53."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r53."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r54 ON r52."RelationshipsTrunkRelationshipsRootId" = r54."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r54."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r55 ON r52."RelationshipsTrunkRelationshipsRootId" = r55."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r52."Id1" = r55."RelationshipsBranchId1" -) AS s5 ON r0."RelationshipsRootId" = s5."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r56 ON r1."RelationshipsTrunkRelationshipsRootId" = r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r57 ON r4."RelationshipsTrunkRelationshipsRootId" = r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r58."RelationshipsTrunkRelationshipsRootId", r58."Id1", r58."Name", r59."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r59."RelationshipsBranchId1", r60."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r60."RelationshipsBranchId1" AS "RelationshipsBranchId10", r61."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r61."RelationshipsBranchId1" AS "RelationshipsBranchId11", r61."Id1" AS "Id10", r61."Name" AS "Name0", r59."Name" AS "Name1", r60."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r58 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r59 ON r58."RelationshipsTrunkRelationshipsRootId" = r59."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r59."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r60 ON r58."RelationshipsTrunkRelationshipsRootId" = r60."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r60."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r61 ON r58."RelationshipsTrunkRelationshipsRootId" = r61."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r58."Id1" = r61."RelationshipsBranchId1" -) AS s6 ON r7."RelationshipsRootId" = s6."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r62 ON r8."RelationshipsTrunkRelationshipsRootId" = r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r63 ON r11."RelationshipsTrunkRelationshipsRootId" = r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."RelationshipsRootId" NULLS FIRST, r8."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsTrunkId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsTrunkId11" NULLS FIRST, s0."Id10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id100" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s0."Id11" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s0."Id12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchId11" NULLS FIRST, s1."Id10" NULLS FIRST, r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r31."Id1" NULLS FIRST, r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r32."Id1" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s2."RelationshipsBranchId10" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s2."RelationshipsBranchId11" NULLS FIRST, s2."Id10" NULLS FIRST, r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r37."Id1" NULLS FIRST, r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r38."Id1" NULLS FIRST, s4."RelationshipsRootId" NULLS FIRST, s4."Id1" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsTrunkId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s4."RelationshipsTrunkId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s4."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s4."RelationshipsTrunkId11" NULLS FIRST, s4."Id10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s4."RelationshipsBranchId1" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s4."RelationshipsBranchId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s4."RelationshipsBranchId11" NULLS FIRST, s4."Id100" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s4."Id11" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s4."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s4."Id12" NULLS FIRST, s5."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."Id1" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s5."RelationshipsBranchId1" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s5."RelationshipsBranchId10" NULLS FIRST, s5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s5."RelationshipsBranchId11" NULLS FIRST, s5."Id10" NULLS FIRST, r56."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r56."Id1" NULLS FIRST, r57."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r57."Id1" NULLS FIRST, s6."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."Id1" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s6."RelationshipsBranchId1" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s6."RelationshipsBranchId10" NULLS FIRST, s6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s6."RelationshipsBranchId11" NULLS FIRST, s6."Id10" NULLS FIRST, r62."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r62."Id1" NULLS FIRST, r63."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r """); } } - public override async Task Select_trunk_and_branch_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_branch_duplicated(async, queryTrackingBehavior); + await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RelationshipsRootId", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r1."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r2."Name", r3."Name", r4."Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r5."Name", r6."Name", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r13."Id1", r13."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchId11", s0."Id10", s0."Name0", s0."Name1", s0."Name2", r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r18."Id1", r18."Name", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r19."Id1", r19."Name", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r20."Id1", r20."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r10."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r13 ON r4."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsTrunkRelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r15."RelationshipsBranchId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r16."RelationshipsBranchId1" AS "RelationshipsBranchId10", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r17."RelationshipsBranchId1" AS "RelationshipsBranchId11", r17."Id1" AS "Id10", r17."Name" AS "Name0", r15."Name" AS "Name1", r16."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r14 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r15 ON r14."RelationshipsTrunkRelationshipsRootId" = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r16 ON r14."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r16."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r17 ON r14."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r17."RelationshipsBranchId1" -) AS s0 ON r0."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r18 ON r1."RelationshipsTrunkRelationshipsRootId" = r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r19 ON r4."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r20 ON r4."RelationshipsTrunkRelationshipsRootId" = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."Id1" NULLS FIRST, r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r13."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id10" NULLS FIRST, r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r18."Id1" NULLS FIRST, r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r19."Id1" NULLS FIRST, r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String" +FROM "RootEntity" AS r """); } } - public override async Task Select_trunk_and_trunk_duplicated(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_trunk_and_trunk_duplicated(async, queryTrackingBehavior); + await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RelationshipsRootId", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r1."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."Id1", r11."Name", r2."Name", r3."Name", r4."Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."Id1", r12."Name", r5."Name", r6."Name", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchId11", s0."Id10", s0."Name0", s0."Name1", s0."Name2", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r17."Id1", r17."Name", r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r18."Id1", r18."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."Id1" = r10."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r13."RelationshipsTrunkRelationshipsRootId", r13."Id1", r13."Name", r14."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r14."RelationshipsBranchId1", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r15."RelationshipsBranchId1" AS "RelationshipsBranchId10", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r16."RelationshipsBranchId1" AS "RelationshipsBranchId11", r16."Id1" AS "Id10", r16."Name" AS "Name0", r14."Name" AS "Name1", r15."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r13 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r14 ON r13."RelationshipsTrunkRelationshipsRootId" = r14."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r13."Id1" = r14."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r15 ON r13."RelationshipsTrunkRelationshipsRootId" = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r13."Id1" = r15."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r16 ON r13."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r13."Id1" = r16."RelationshipsBranchId1" -) AS s0 ON r0."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r17 ON r1."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r18 ON r4."RelationshipsTrunkRelationshipsRootId" = r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."Id1" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id10" NULLS FIRST, r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r17."Id1" NULLS FIRST, r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r0."Id", r0."RequiredRelated_Id", r0."RequiredRelated_Int", r0."RequiredRelated_Name", r0."RequiredRelated_String", r."Id", r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Name", r1."String", r0."RequiredRelated_OptionalNested_Id", r0."RequiredRelated_OptionalNested_Int", r0."RequiredRelated_OptionalNested_Name", r0."RequiredRelated_OptionalNested_String", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +LEFT JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."Id" = r1."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_leaf_trunk_root(bool async, QueryTrackingBehavior queryTrackingBehavior) - { - await base.Select_leaf_trunk_root(async, queryTrackingBehavior); + #endregion Non-collection - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."Name", r0."RelationshipsRootId", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r3."RelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."RelationshipsRootId", r8."RelationshipsTrunkRelationshipsRootId", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsTrunkRelationshipsRootId", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r3."Name", r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r18."Id1", r18."Name", r4."Name", r5."Name", r1."Name", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r19."Id1", r19."Name", r6."Name", r."Name", r."OptionalReferenceTrunkId", r."RequiredReferenceTrunkId", s1."RelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."RelationshipsTrunkId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchRelationshipsTrunkId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchRelationshipsTrunkId10", s1."RelationshipsTrunkRelationshipsRootId0", s1."RelationshipsTrunkId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchRelationshipsTrunkId11", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s1."RelationshipsBranchRelationshipsTrunkId12", s1."RelationshipsTrunkRelationshipsRootId1", s1."RelationshipsTrunkId11", s1."Id10", s1."Name0", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s1."RelationshipsBranchRelationshipsTrunkId13", s1."RelationshipsBranchId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s1."RelationshipsBranchRelationshipsTrunkId100", s1."RelationshipsBranchId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s1."RelationshipsBranchRelationshipsTrunkId110", s1."RelationshipsBranchId11", s1."Id100", s1."Name00", s1."Name1", s1."Name2", s1."Name3", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", s1."RelationshipsBranchRelationshipsTrunkId14", s1."Id11", s1."Name4", s1."Name5", s1."Name6", s1."Name7", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", s1."RelationshipsBranchRelationshipsTrunkId15", s1."Id12", s1."Name8", s1."Name9", s1."Name10", r7."Name", s2."RelationshipsTrunkRelationshipsRootId", s2."Id1", s2."Name", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s2."RelationshipsBranchId1", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s2."RelationshipsBranchId10", s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s2."RelationshipsBranchId11", s2."Id10", s2."Name0", s2."Name1", s2."Name2", r8."Name", r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r37."Id1", r37."Name", r9."Name", r10."Name", r11."Name", r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r38."Id1", r38."Name", r12."Name", r13."Name", s3."RelationshipsTrunkRelationshipsRootId", s3."Id1", s3."Name", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s3."RelationshipsBranchId1", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s3."RelationshipsBranchId10", s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s3."RelationshipsBranchId11", s3."Id10", s3."Name0", s3."Name1", s3."Name2", r43."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r43."Id1", r43."Name", r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r44."Id1", r44."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r3 ON r0."RelationshipsRootId" = r3."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r4 ON r3."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r5 ON r3."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r6 ON r1."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk" AS r7 ON r."Id" = r7."RelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r8 ON r7."RelationshipsRootId" = r8."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r9 ON r8."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r10 ON r8."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch" AS r11 ON r7."RelationshipsRootId" = r11."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r12 ON r11."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r13 ON r11."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsTrunkRelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r15."RelationshipsBranchId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r16."RelationshipsBranchId1" AS "RelationshipsBranchId10", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r17."RelationshipsBranchId1" AS "RelationshipsBranchId11", r17."Id1" AS "Id10", r17."Name" AS "Name0", r15."Name" AS "Name1", r16."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r14 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r15 ON r14."RelationshipsTrunkRelationshipsRootId" = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r16 ON r14."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r16."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r17 ON r14."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r17."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r18 ON r3."RelationshipsTrunkRelationshipsRootId" = r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r19 ON r1."RelationshipsTrunkRelationshipsRootId" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r20."RelationshipsRootId", r20."Id1", r20."Name", r21."RelationshipsTrunkRelationshipsRootId", r21."RelationshipsTrunkId1", r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r22."RelationshipsBranchRelationshipsTrunkId1", r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r23."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r24."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r24."RelationshipsTrunkId1" AS "RelationshipsTrunkId10", r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r25."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r26."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId12", s0."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId1", s0."RelationshipsTrunkId1" AS "RelationshipsTrunkId11", s0."Id1" AS "Id10", s0."Name" AS "Name0", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId3", s0."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId13", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId00", s0."RelationshipsBranchRelationshipsTrunkId10" AS "RelationshipsBranchRelationshipsTrunkId100", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId10", s0."RelationshipsBranchRelationshipsTrunkId11" AS "RelationshipsBranchRelationshipsTrunkId110", s0."RelationshipsBranchId11", s0."Id10" AS "Id100", s0."Name0" AS "Name00", s0."Name1", s0."Name2", r21."Name" AS "Name3", r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId4", r31."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId14", r31."Id1" AS "Id11", r31."Name" AS "Name4", r22."Name" AS "Name5", r23."Name" AS "Name6", r24."Name" AS "Name7", r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId5", r32."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId15", r32."Id1" AS "Id12", r32."Name" AS "Name8", r25."Name" AS "Name9", r26."Name" AS "Name10" - FROM "RelationshipsRoot_CollectionTrunk" AS r20 - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r21 ON r20."RelationshipsRootId" = r21."RelationshipsTrunkRelationshipsRootId" AND r20."Id1" = r21."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r22 ON r21."RelationshipsTrunkRelationshipsRootId" = r22."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r22."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r23 ON r21."RelationshipsTrunkRelationshipsRootId" = r23."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r23."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r24 ON r20."RelationshipsRootId" = r24."RelationshipsTrunkRelationshipsRootId" AND r20."Id1" = r24."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r25 ON r24."RelationshipsTrunkRelationshipsRootId" = r25."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r24."RelationshipsTrunkId1" = r25."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r26 ON r24."RelationshipsTrunkRelationshipsRootId" = r26."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r24."RelationshipsTrunkId1" = r26."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN ( - SELECT r27."RelationshipsTrunkRelationshipsRootId", r27."RelationshipsTrunkId1", r27."Id1", r27."Name", r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r28."RelationshipsBranchRelationshipsTrunkId1", r28."RelationshipsBranchId1", r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r29."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r29."RelationshipsBranchId1" AS "RelationshipsBranchId10", r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r30."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r30."RelationshipsBranchId1" AS "RelationshipsBranchId11", r30."Id1" AS "Id10", r30."Name" AS "Name0", r28."Name" AS "Name1", r29."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r27 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r28 ON r27."RelationshipsTrunkRelationshipsRootId" = r28."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."RelationshipsTrunkId1" = r28."RelationshipsBranchRelationshipsTrunkId1" AND r27."Id1" = r28."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r29 ON r27."RelationshipsTrunkRelationshipsRootId" = r29."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."RelationshipsTrunkId1" = r29."RelationshipsBranchRelationshipsTrunkId1" AND r27."Id1" = r29."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r30 ON r27."RelationshipsTrunkRelationshipsRootId" = r30."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r27."RelationshipsTrunkId1" = r30."RelationshipsBranchRelationshipsTrunkId1" AND r27."Id1" = r30."RelationshipsBranchId1" - ) AS s0 ON r20."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" AND r20."Id1" = s0."RelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r31 ON r21."RelationshipsTrunkRelationshipsRootId" = r31."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r21."RelationshipsTrunkId1" = r31."RelationshipsBranchRelationshipsTrunkId1" - LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r32 ON r24."RelationshipsTrunkRelationshipsRootId" = r32."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r24."RelationshipsTrunkId1" = r32."RelationshipsBranchRelationshipsTrunkId1" -) AS s1 ON r."Id" = s1."RelationshipsRootId" -LEFT JOIN ( - SELECT r33."RelationshipsTrunkRelationshipsRootId", r33."Id1", r33."Name", r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r34."RelationshipsBranchId1", r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r35."RelationshipsBranchId1" AS "RelationshipsBranchId10", r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r36."RelationshipsBranchId1" AS "RelationshipsBranchId11", r36."Id1" AS "Id10", r36."Name" AS "Name0", r34."Name" AS "Name1", r35."Name" AS "Name2" - FROM "Root_OptionalReferenceTrunk_CollectionBranch" AS r33 - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r34 ON r33."RelationshipsTrunkRelationshipsRootId" = r34."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r34."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r35 ON r33."RelationshipsTrunkRelationshipsRootId" = r35."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r35."RelationshipsBranchId1" - LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r36 ON r33."RelationshipsTrunkRelationshipsRootId" = r36."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r33."Id1" = r36."RelationshipsBranchId1" -) AS s2 ON r7."RelationshipsRootId" = s2."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r37 ON r8."RelationshipsTrunkRelationshipsRootId" = r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_RequiredReferenceBranch_Collection~" AS r38 ON r11."RelationshipsTrunkRelationshipsRootId" = r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r39."RelationshipsTrunkRelationshipsRootId", r39."Id1", r39."Name", r40."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r40."RelationshipsBranchId1", r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r41."RelationshipsBranchId1" AS "RelationshipsBranchId10", r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r42."RelationshipsBranchId1" AS "RelationshipsBranchId11", r42."Id1" AS "Id10", r42."Name" AS "Name0", r40."Name" AS "Name1", r41."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r39 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r40 ON r39."RelationshipsTrunkRelationshipsRootId" = r40."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r40."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r41 ON r39."RelationshipsTrunkRelationshipsRootId" = r41."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r41."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r42 ON r39."RelationshipsTrunkRelationshipsRootId" = r42."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r39."Id1" = r42."RelationshipsBranchId1" -) AS s3 ON r0."RelationshipsRootId" = s3."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r43 ON r3."RelationshipsTrunkRelationshipsRootId" = r43."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r44 ON r1."RelationshipsTrunkRelationshipsRootId" = r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r7."RelationshipsRootId" NULLS FIRST, r8."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r18."Id1" NULLS FIRST, r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r19."Id1" NULLS FIRST, s1."RelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsTrunkId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsTrunkId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId12" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsTrunkId11" NULLS FIRST, s1."Id10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId3" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId13" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId00" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId100" NULLS FIRST, s1."RelationshipsBranchId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId110" NULLS FIRST, s1."RelationshipsBranchId11" NULLS FIRST, s1."Id100" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId4" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId14" NULLS FIRST, s1."Id11" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId5" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkId15" NULLS FIRST, s1."Id12" NULLS FIRST, s2."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."Id1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s2."RelationshipsBranchId1" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s2."RelationshipsBranchId10" NULLS FIRST, s2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s2."RelationshipsBranchId11" NULLS FIRST, s2."Id10" NULLS FIRST, r37."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r37."Id1" NULLS FIRST, r38."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r38."Id1" NULLS FIRST, s3."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s3."Id1" NULLS FIRST, s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s3."RelationshipsBranchId1" NULLS FIRST, s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s3."RelationshipsBranchId10" NULLS FIRST, s3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s3."RelationshipsBranchId11" NULLS FIRST, s3."Id10" NULLS FIRST, r43."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r43."Id1" NULLS FIRST, r44."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST -"""); - } - } + #region Collection - public override async Task Select_multiple_branch_leaf(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_multiple_branch_leaf(async, queryTrackingBehavior); + await base.Select_related_collection(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r1."RelationshipsTrunkRelationshipsRootId", r1."Name", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."Id1", r4."Name", r2."Name", r3."Name", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r5 ON r1."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r6."RelationshipsTrunkRelationshipsRootId", r6."Id1", r6."Name", r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r7."RelationshipsBranchId1", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r8."RelationshipsBranchId1" AS "RelationshipsBranchId10", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r9."RelationshipsBranchId1" AS "RelationshipsBranchId11", r9."Id1" AS "Id10", r9."Name" AS "Name0", r7."Name" AS "Name1", r8."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r6 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r7 ON r6."RelationshipsTrunkRelationshipsRootId" = r7."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r6."Id1" = r7."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r8 ON r6."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r6."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r9 ON r6."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r6."Id1" = r9."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."Id1" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."Id1" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST """); } } - #endregion Multiple - - #region Subquery - - public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_nested_collection_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT s."RelationshipsTrunkRelationshipsRootId", s."Name", r."Id", s."Id", s."RelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", s."Name0", s."Name1" -FROM "RelationshipsRoot" AS r -LEFT JOIN LATERAL ( - SELECT r2."RelationshipsTrunkRelationshipsRootId", r2."Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Name" AS "Name0", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r4."Name" AS "Name1", r0."Id", r1."RelationshipsRootId" - FROM "RelationshipsRoot" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk" AS r1 ON r0."Id" = r1."RelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r2 ON r1."RelationshipsRootId" = r2."RelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r3 ON r2."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r4 ON r2."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r5 ON s."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."RelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Name", r0."String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async, queryTrackingBehavior); + await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT s."RelationshipsTrunkRelationshipsRootId", s."Name", r."Id", s."Id", s."RelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."Id1", r5."Name", s."Name0", s."Name1" -FROM "RelationshipsRoot" AS r -LEFT JOIN LATERAL ( - SELECT r2."RelationshipsTrunkRelationshipsRootId", r2."Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."Name" AS "Name0", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r4."Name" AS "Name1", r0."Id", r1."RelationshipsRootId" - FROM "RelationshipsRoot" AS r0 - LEFT JOIN "Root_OptionalReferenceTrunk" AS r1 ON r0."Id" = r1."RelationshipsRootId" - LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch" AS r2 ON r1."RelationshipsRootId" = r2."RelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r3 ON r2."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r4 ON r2."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN "Root_OptionalReferenceTrunk_OptionalReferenceBranch_Collection~" AS r5 ON s."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."RelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r."Id", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async, queryTrackingBehavior); + await base.SelectMany_related_collection(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", s."Id", s."RelationshipsRootId", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchId11", s0."Id10", s0."Name0", s0."Name1", s0."Name2", s.c -FROM "RelationshipsRoot" AS r -LEFT JOIN LATERAL ( - SELECT 1 AS c, r0."Id", r1."RelationshipsRootId" - FROM "RelationshipsRoot" AS r0 - LEFT JOIN "Root_RequiredReferenceTrunk" AS r1 ON r0."Id" = r1."RelationshipsRootId" - ORDER BY r0."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN ( - SELECT r2."RelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchId1", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r4."RelationshipsBranchId1" AS "RelationshipsBranchId10", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r5."RelationshipsBranchId1" AS "RelationshipsBranchId11", r5."Id1" AS "Id10", r5."Name" AS "Name0", r3."Name" AS "Name1", r4."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r2 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r3 ON r2."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r3."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r4 ON r2."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r4."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r5 ON r2."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r5."RelationshipsBranchId1" -) AS s0 ON s."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."RelationshipsRootId" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id", r1."Int", r1."Name", r1."String", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" +FROM "RootEntity" AS r +INNER JOIN "RelatedCollection" AS r0 ON r."Id" = r0."RootEntityId" +LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r0."Id" NULLS FIRST, r1."RelatedTypeRootEntityId" NULLS FIRST, r1."RelatedTypeId" NULLS FIRST """); } } - public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RelationshipsRootId", r1."RelationshipsTrunkRelationshipsRootId", s."Id", s."RelationshipsRootId", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", s0."RelationshipsTrunkRelationshipsRootId", s0."Id1", s0."Name", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s0."RelationshipsBranchId1", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s0."RelationshipsBranchId10", s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s0."RelationshipsBranchId11", s0."Id10", s0."Name0", s0."Name1", s0."Name2", s."Name", s1."RelationshipsTrunkRelationshipsRootId", s1."Id1", s1."Name", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s1."RelationshipsBranchId1", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s1."RelationshipsBranchId10", s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s1."RelationshipsBranchId11", s1."Id10", s1."Name0", s1."Name1", s1."Name2", s."Name0", r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r18."Id1", r18."Name", s."Name1", s."Name2", s."Name3", r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r19."Id1", r19."Name", s."Name4", s."Name5", r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r20."Id1", r20."Name", s."Name6", s.c -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN LATERAL ( - SELECT r3."RelationshipsRootId", r3."Name", r4."RelationshipsTrunkRelationshipsRootId", r4."Name" AS "Name0", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."Name" AS "Name1", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r6."Name" AS "Name2", r7."RelationshipsTrunkRelationshipsRootId" AS "RelationshipsTrunkRelationshipsRootId0", r7."Name" AS "Name3", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r8."Name" AS "Name4", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId2", r9."Name" AS "Name5", r1."Name" AS "Name6", 1 AS c, r2."Id" - FROM "RelationshipsRoot" AS r2 - LEFT JOIN "Root_RequiredReferenceTrunk" AS r3 ON r2."Id" = r3."RelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch" AS r4 ON r3."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch" AS r7 ON r3."RelationshipsRootId" = r7."RelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" - ORDER BY r2."Id" NULLS FIRST - LIMIT 1 -) AS s ON TRUE -LEFT JOIN ( - SELECT r10."RelationshipsTrunkRelationshipsRootId", r10."Id1", r10."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsBranchId1", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r12."RelationshipsBranchId1" AS "RelationshipsBranchId10", r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r13."RelationshipsBranchId1" AS "RelationshipsBranchId11", r13."Id1" AS "Id10", r13."Name" AS "Name0", r11."Name" AS "Name1", r12."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r10 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r11 ON r10."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r10."Id1" = r11."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r12 ON r10."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r10."Id1" = r12."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r13 ON r10."RelationshipsTrunkRelationshipsRootId" = r13."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r10."Id1" = r13."RelationshipsBranchId1" -) AS s0 ON r0."RelationshipsRootId" = s0."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN ( - SELECT r14."RelationshipsTrunkRelationshipsRootId", r14."Id1", r14."Name", r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r15."RelationshipsBranchId1", r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r16."RelationshipsBranchId1" AS "RelationshipsBranchId10", r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r17."RelationshipsBranchId1" AS "RelationshipsBranchId11", r17."Id1" AS "Id10", r17."Name" AS "Name0", r15."Name" AS "Name1", r16."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r14 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r15 ON r14."RelationshipsTrunkRelationshipsRootId" = r15."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r15."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r16 ON r14."RelationshipsTrunkRelationshipsRootId" = r16."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r16."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r17 ON r14."RelationshipsTrunkRelationshipsRootId" = r17."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r14."Id1" = r17."RelationshipsBranchId1" -) AS s1 ON s."RelationshipsRootId" = s1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_OptionalReferenceBranch_Collection~" AS r18 ON s."RelationshipsTrunkRelationshipsRootId" = r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r19 ON s."RelationshipsTrunkRelationshipsRootId0" = r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_RequiredReferenceBranch_Collection~" AS r20 ON s."RelationshipsTrunkRelationshipsRootId0" = r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id" NULLS FIRST, s."RelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId2" NULLS FIRST, s0."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."Id1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s0."RelationshipsBranchId1" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s0."RelationshipsBranchId10" NULLS FIRST, s0."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s0."RelationshipsBranchId11" NULLS FIRST, s0."Id10" NULLS FIRST, s1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."Id1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s1."RelationshipsBranchId1" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s1."RelationshipsBranchId10" NULLS FIRST, s1."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s1."RelationshipsBranchId11" NULLS FIRST, s1."Id10" NULLS FIRST, r18."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r18."Id1" NULLS FIRST, r19."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r19."Id1" NULLS FIRST, r20."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST +SELECT r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Name", r0."String" +FROM "RootEntity" AS r +INNER JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."RelatedTypeRootEntityId" """); } } - public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async, queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RelationshipsRootId", r6."Id", s."RelationshipsTrunkRelationshipsRootId", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r6.c -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN LATERAL ( - SELECT 1 AS c, r1."Id" - FROM "RelationshipsRoot" AS r1 - ORDER BY r1."Id" NULLS FIRST - LIMIT 1 -) AS r6 ON TRUE -LEFT JOIN ( - SELECT r2."RelationshipsTrunkRelationshipsRootId", r2."Id1", r2."Name", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchId1", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r4."RelationshipsBranchId1" AS "RelationshipsBranchId10", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r5."RelationshipsBranchId1" AS "RelationshipsBranchId11", r5."Id1" AS "Id10", r5."Name" AS "Name0", r3."Name" AS "Name1", r4."Name" AS "Name2" - FROM "Root_RequiredReferenceTrunk_CollectionBranch" AS r2 - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r3 ON r2."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r3."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r4 ON r2."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r4."RelationshipsBranchId1" - LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r5 ON r2."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r2."Id1" = r5."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r6."Id" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST +SELECT o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String" +FROM "RootEntity" AS r +INNER JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" """); } } - #endregion Subquery + #endregion Collection - #region SelectMany + #region Multiple - public override async Task SelectMany_trunk_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_trunk_collection(async, queryTrackingBehavior); + await base.Select_root_duplicated(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else - { - AssertSql( - """ -SELECT r0."RelationshipsRootId", r0."Id1", r0."Name", r."Id", r1."RelationshipsTrunkRelationshipsRootId", r1."RelationshipsTrunkId1", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchRelationshipsTrunkId1", r4."RelationshipsTrunkRelationshipsRootId", r4."RelationshipsTrunkId1", r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r5."RelationshipsBranchRelationshipsTrunkId1", r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r6."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsTrunkRelationshipsRootId", s."RelationshipsTrunkId1", s."Id1", s."Name", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", s."RelationshipsBranchRelationshipsTrunkId1", s."RelationshipsBranchId1", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", s."RelationshipsBranchRelationshipsTrunkId10", s."RelationshipsBranchId10", s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", s."RelationshipsBranchRelationshipsTrunkId11", s."RelationshipsBranchId11", s."Id10", s."Name0", s."Name1", s."Name2", r1."Name", r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r11."RelationshipsBranchRelationshipsTrunkId1", r11."Id1", r11."Name", r2."Name", r3."Name", r4."Name", r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r12."RelationshipsBranchRelationshipsTrunkId1", r12."Id1", r12."Name", r5."Name", r6."Name" -FROM "RelationshipsRoot" AS r -INNER JOIN "RelationshipsRoot_CollectionTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r1."RelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r2."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r3."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch" AS r4 ON r0."RelationshipsRootId" = r4."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = r4."RelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf" AS r5 ON r4."RelationshipsTrunkRelationshipsRootId" = r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r5."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf" AS r6 ON r4."RelationshipsTrunkRelationshipsRootId" = r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r6."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN ( - SELECT r7."RelationshipsTrunkRelationshipsRootId", r7."RelationshipsTrunkId1", r7."Id1", r7."Name", r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r8."RelationshipsBranchRelationshipsTrunkId1", r8."RelationshipsBranchId1", r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId0", r9."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId10", r9."RelationshipsBranchId1" AS "RelationshipsBranchId10", r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AS "RelationshipsBranchRelationshipsTrunkRelationshipsRootId1", r10."RelationshipsBranchRelationshipsTrunkId1" AS "RelationshipsBranchRelationshipsTrunkId11", r10."RelationshipsBranchId1" AS "RelationshipsBranchId11", r10."Id1" AS "Id10", r10."Name" AS "Name0", r8."Name" AS "Name1", r9."Name" AS "Name2" - FROM "RelationshipsRoot_CollectionTrunk_CollectionBranch" AS r7 - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf" AS r8 ON r7."RelationshipsTrunkRelationshipsRootId" = r8."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r8."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r8."RelationshipsBranchId1" - LEFT JOIN "Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf" AS r9 ON r7."RelationshipsTrunkRelationshipsRootId" = r9."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r9."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r9."RelationshipsBranchId1" - LEFT JOIN "RelationshipsRoot_CollectionTrunk_CollectionBranch_CollectionL~" AS r10 ON r7."RelationshipsTrunkRelationshipsRootId" = r10."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r7."RelationshipsTrunkId1" = r10."RelationshipsBranchRelationshipsTrunkId1" AND r7."Id1" = r10."RelationshipsBranchId1" -) AS s ON r0."RelationshipsRootId" = s."RelationshipsTrunkRelationshipsRootId" AND r0."Id1" = s."RelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf" AS r11 ON r1."RelationshipsTrunkRelationshipsRootId" = r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."RelationshipsTrunkId1" = r11."RelationshipsBranchRelationshipsTrunkId1" -LEFT JOIN "Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf" AS r12 ON r4."RelationshipsTrunkRelationshipsRootId" = r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r4."RelationshipsTrunkId1" = r12."RelationshipsBranchRelationshipsTrunkId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r0."Id1" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkId1" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, r4."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsTrunkId1" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r5."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r6."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsTrunkId1" NULLS FIRST, s."Id1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, s."RelationshipsBranchId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId0" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkId10" NULLS FIRST, s."RelationshipsBranchId10" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkRelationshipsRootId1" NULLS FIRST, s."RelationshipsBranchRelationshipsTrunkId11" NULLS FIRST, s."RelationshipsBranchId11" NULLS FIRST, s."Id10" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r11."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST, r11."Id1" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r12."RelationshipsBranchRelationshipsTrunkId1" NULLS FIRST + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String", o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Name", o0."String", s0."RootEntityId", s0."Id", s0."Int", s0."Name", s0."String", s0."RelatedTypeRootEntityId", s0."RelatedTypeId", s0."Id0", s0."Int0", s0."Name0", s0."String0", s0."OptionalNested_Id", s0."OptionalNested_Int", s0."OptionalNested_Name", s0."OptionalNested_String", s0."RequiredNested_Id", s0."RequiredNested_Int", s0."RequiredNested_Name", s0."RequiredNested_String", r5."RelatedTypeRootEntityId", r5."Id", r5."Int", r5."Name", r5."String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o0 ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o0."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Name" AS "Name0", r4."String" AS "String0", r3."OptionalNested_Id", r3."OptionalNested_Int", r3."OptionalNested_Name", r3."OptionalNested_String", r3."RequiredNested_Id", r3."RequiredNested_Int", r3."RequiredNested_Name", r3."RequiredNested_String" + FROM "RelatedCollection" AS r3 + LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" +) AS s0 ON r."Id" = s0."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r5 ON r."Id" = r5."RelatedTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST, r2."Id" NULLS FIRST, o0."RelatedTypeRootEntityId" NULLS FIRST, o0."Id" NULLS FIRST, s0."RootEntityId" NULLS FIRST, s0."Id" NULLS FIRST, s0."RelatedTypeRootEntityId" NULLS FIRST, s0."RelatedTypeId" NULLS FIRST, s0."Id0" NULLS FIRST, r5."RelatedTypeRootEntityId" NULLS FIRST """); - } } - public override async Task SelectMany_required_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_required_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchId1", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchId1", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_RequiredReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -INNER JOIN "Root_RequiredReferenceTrunk_CollectionBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" -LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r3."RelationshipsBranchId1" -LEFT JOIN "Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r4."RelationshipsBranchId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."Id1" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchId1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchId1" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchId1" NULLS FIRST +SELECT r1."Id", r1."RequiredRelated_RequiredNested_Id", r1."RequiredRelated_RequiredNested_Int", r1."RequiredRelated_RequiredNested_Name", r1."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."Id", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE """); } } - public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async, QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_optional_trunk_reference_branch_collection(async, queryTrackingBehavior); + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); - if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) - { - AssertSql(); - } - else + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelationshipsTrunkRelationshipsRootId", r1."Id1", r1."Name", r."Id", r0."RelationshipsRootId", r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r2."RelationshipsBranchId1", r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r3."RelationshipsBranchId1", r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId", r4."RelationshipsBranchId1", r4."Id1", r4."Name", r2."Name", r3."Name" -FROM "RelationshipsRoot" AS r -LEFT JOIN "Root_OptionalReferenceTrunk" AS r0 ON r."Id" = r0."RelationshipsRootId" -INNER JOIN "Root_OptionalReferenceTrunk_CollectionBranch" AS r1 ON r0."RelationshipsRootId" = r1."RelationshipsTrunkRelationshipsRootId" -LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf" AS r2 ON r1."RelationshipsTrunkRelationshipsRootId" = r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r2."RelationshipsBranchId1" -LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf" AS r3 ON r1."RelationshipsTrunkRelationshipsRootId" = r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r3."RelationshipsBranchId1" -LEFT JOIN "Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf" AS r4 ON r1."RelationshipsTrunkRelationshipsRootId" = r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" AND r1."Id1" = r4."RelationshipsBranchId1" -ORDER BY r."Id" NULLS FIRST, r0."RelationshipsRootId" NULLS FIRST, r1."RelationshipsTrunkRelationshipsRootId" NULLS FIRST, r1."Id1" NULLS FIRST, r2."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r2."RelationshipsBranchId1" NULLS FIRST, r3."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r3."RelationshipsBranchId1" NULLS FIRST, r4."RelationshipsBranchRelationshipsTrunkRelationshipsRootId" NULLS FIRST, r4."RelationshipsBranchId1" NULLS FIRST +SELECT r1."Id", r1."OptionalRelated_RequiredNested_Id", r1."OptionalRelated_RequiredNested_Int", r1."OptionalRelated_RequiredNested_Name", r1."OptionalRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN LATERAL ( + SELECT r0."Id", r0."OptionalRelated_RequiredNested_Id", r0."OptionalRelated_RequiredNested_Int", r0."OptionalRelated_RequiredNested_Name", r0."OptionalRelated_RequiredNested_String" + FROM "RootEntity" AS r0 + ORDER BY r0."Id" NULLS FIRST + LIMIT 1 +) AS r1 ON TRUE """); } } - #endregion SelectMany + #endregion Subquery [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - - private void AssertSql(params string[] expected) - => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingRelationshipsNpgsqlFixture.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingRelationshipsNpgsqlFixture.cs deleted file mode 100644 index e504317f08..0000000000 --- a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingRelationshipsNpgsqlFixture.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Microsoft.EntityFrameworkCore.Query.Relationships.OwnedTableSplitting; - -public class OwnedTableSplittingRelationshipsNpgsqlFixture : OwnedTableSplittingRelationalFixtureBase, ITestSqlLoggerFactory -{ - protected override ITestStoreFactory TestStoreFactory - => NpgsqlTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; -} diff --git a/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs new file mode 100644 index 0000000000..fc000c6901 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Query/Relationships/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs @@ -0,0 +1,201 @@ +// 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.Relationships.OwnedTableSplitting; + +// TODO: Unskip (remove abstract) for 10.0.0-rc.2, https://github.com/dotnet/efcore/pull/36595 +public abstract class OwnedTableSplittingStructuralEqualityNpgsqlTest( + OwnedTableSplittingNpgsqlFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_related() + { + await base.Two_related(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Two_nested() + { + await base.Two_nested(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Related_with_inline_null() + { + await base.Related_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE r."OptionalRelated_Id" IS NULL OR r."OptionalRelated_Int" IS NULL OR r."OptionalRelated_Name" IS NULL OR r."OptionalRelated_String" IS NULL +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Related_with_parameter_null() + { + await base.Related_with_parameter_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END IS NULL +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline_null() + { + await base.Nested_with_inline_null(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE r."RequiredRelated_OptionalNested_Id" IS NULL OR r."RequiredRelated_OptionalNested_Int" IS NULL OR r."RequiredRelated_OptionalNested_Name" IS NULL OR r."RequiredRelated_OptionalNested_String" IS NULL +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_with_inline() + { + await base.Nested_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_with_parameter() + { + await base.Nested_with_parameter(); + + AssertSql( + ); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +FROM "RootEntity" AS r +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" +END = o."RelatedTypeRootEntityId" +LEFT JOIN ( + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Name", r0."RequiredNested_String" + FROM "RelatedCollection" AS r0 + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" +) AS s ON r."Id" = s."RootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +WHERE FALSE +ORDER BY r."Id" NULLS FIRST, o."RelatedTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."RelatedTypeRootEntityId" NULLS FIRST, s."RelatedTypeId" NULLS FIRST, s."Id0" NULLS FIRST, r2."RelatedTypeRootEntityId" NULLS FIRST +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs index 898a0777d7..6283b42538 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs @@ -10,9 +10,9 @@ public ByteArrayTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITe Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Length(bool async) + public override async Task Length() { - await base.Length(async); + await base.Length(); AssertSql( """ @@ -22,9 +22,9 @@ WHERE length(b."ByteArray") = 4 """); } - public override async Task Index(bool async) + public override async Task Index() { - await base.Index(async); + await base.Index(); AssertSql( """ @@ -34,9 +34,9 @@ WHERE length(b."ByteArray") >= 3 AND get_byte(b."ByteArray", 2) = 190 """); } - public override async Task First(bool async) + public override async Task First() { - await base.First(async); + await base.First(); AssertSql( """ @@ -46,9 +46,9 @@ WHERE length(b."ByteArray") >= 1 AND get_byte(b."ByteArray", 0)::smallint = 222 """); } - public override async Task Contains_with_constant(bool async) + public override async Task Contains_with_constant() { - await base.Contains_with_constant(async); + await base.Contains_with_constant(); AssertSql( """ @@ -58,9 +58,9 @@ WHERE position(BYTEA E'\\x01' IN b."ByteArray") > 0 """); } - public override async Task Contains_with_parameter(bool async) + public override async Task Contains_with_parameter() { - await base.Contains_with_parameter(async); + await base.Contains_with_parameter(); AssertSql( """ @@ -72,9 +72,9 @@ WHERE position(set_byte(BYTEA E'\\x00', 0, @someByte) IN b."ByteArray") > 0 """); } - public override async Task Contains_with_column(bool async) + public override async Task Contains_with_column() { - await base.Contains_with_column(async); + await base.Contains_with_column(); AssertSql( """ @@ -84,9 +84,9 @@ WHERE position(set_byte(BYTEA E'\\x00', 0, b."Byte") IN b."ByteArray") > 0 """); } - public override async Task SequenceEqual(bool async) + public override async Task SequenceEqual() { - await base.SequenceEqual(async); + await base.SequenceEqual(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/EnumTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/EnumTranslationsNpgsqlTest.cs index a0956799ab..e079200485 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/EnumTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/EnumTranslationsNpgsqlTest.cs @@ -11,9 +11,9 @@ public EnumTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITestOut #region Equality - public override async Task Equality_to_constant(bool async) + public override async Task Equality_to_constant() { - await base.Equality_to_constant(async); + await base.Equality_to_constant(); AssertSql( """ @@ -23,9 +23,9 @@ public override async Task Equality_to_constant(bool async) """); } - public override async Task Equality_to_parameter(bool async) + public override async Task Equality_to_parameter() { - await base.Equality_to_parameter(async); + await base.Equality_to_parameter(); AssertSql( """ @@ -37,9 +37,9 @@ public override async Task Equality_to_parameter(bool async) """); } - public override async Task Equality_nullable_enum_to_constant(bool async) + public override async Task Equality_nullable_enum_to_constant() { - await base.Equality_nullable_enum_to_constant(async); + await base.Equality_nullable_enum_to_constant(); AssertSql( """ @@ -49,9 +49,9 @@ public override async Task Equality_nullable_enum_to_constant(bool async) """); } - public override async Task Equality_nullable_enum_to_parameter(bool async) + public override async Task Equality_nullable_enum_to_parameter() { - await base.Equality_nullable_enum_to_parameter(async); + await base.Equality_nullable_enum_to_parameter(); AssertSql( """ @@ -63,9 +63,9 @@ public override async Task Equality_nullable_enum_to_parameter(bool async) """); } - public override async Task Equality_nullable_enum_to_null_constant(bool async) + public override async Task Equality_nullable_enum_to_null_constant() { - await base.Equality_nullable_enum_to_null_constant(async); + await base.Equality_nullable_enum_to_null_constant(); AssertSql( """ @@ -75,9 +75,9 @@ WHERE n."Enum" IS NULL """); } - public override async Task Equality_nullable_enum_to_null_parameter(bool async) + public override async Task Equality_nullable_enum_to_null_parameter() { - await base.Equality_nullable_enum_to_null_parameter(async); + await base.Equality_nullable_enum_to_null_parameter(); AssertSql( """ @@ -87,9 +87,9 @@ WHERE n."Enum" IS NULL """); } - public override async Task Equality_nullable_enum_to_nullable_parameter(bool async) + public override async Task Equality_nullable_enum_to_nullable_parameter() { - await base.Equality_nullable_enum_to_nullable_parameter(async); + await base.Equality_nullable_enum_to_nullable_parameter(); AssertSql( """ @@ -103,9 +103,9 @@ public override async Task Equality_nullable_enum_to_nullable_parameter(bool asy #endregion Equality - public override async Task Bitwise_and_enum_constant(bool async) + public override async Task Bitwise_and_enum_constant() { - await base.Bitwise_and_enum_constant(async); + await base.Bitwise_and_enum_constant(); AssertSql( """ @@ -121,9 +121,9 @@ WHERE b."FlagsEnum" & 1 > 0 """); } - public override async Task Bitwise_and_integral_constant(bool async) + public override async Task Bitwise_and_integral_constant() { - await base.Bitwise_and_integral_constant(async); + await base.Bitwise_and_integral_constant(); AssertSql( """ @@ -145,9 +145,9 @@ public override async Task Bitwise_and_integral_constant(bool async) """); } - public override async Task Bitwise_and_nullable_enum_with_constant(bool async) + public override async Task Bitwise_and_nullable_enum_with_constant() { - await base.Bitwise_and_nullable_enum_with_constant(async); + await base.Bitwise_and_nullable_enum_with_constant(); AssertSql( """ @@ -157,9 +157,9 @@ WHERE n."FlagsEnum" & 8 > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bool async) + public override async Task Where_bitwise_and_nullable_enum_with_null_constant() { - await base.Where_bitwise_and_nullable_enum_with_null_constant(async); + await base.Where_bitwise_and_nullable_enum_with_null_constant(); AssertSql( """ @@ -169,9 +169,9 @@ WHERE n."FlagsEnum" & NULL > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter(bool async) + public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter() { - await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(async); + await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(); AssertSql( """ @@ -183,9 +183,9 @@ WHERE n."FlagsEnum" & @flagsEnum > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter(bool async) + public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter() { - await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(async); + await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(); AssertSql( """ @@ -203,9 +203,9 @@ WHERE n."FlagsEnum" & NULL > 0 """); } - public override async Task Bitwise_or(bool async) + public override async Task Bitwise_or() { - await base.Bitwise_or(async); + await base.Bitwise_or(); AssertSql( """ @@ -215,9 +215,9 @@ WHERE b."FlagsEnum" | 8 > 0 """); } - public override async Task Bitwise_projects_values_in_select(bool async) + public override async Task Bitwise_projects_values_in_select() { - await base.Bitwise_projects_values_in_select(async); + await base.Bitwise_projects_values_in_select(); AssertSql( """ @@ -228,9 +228,9 @@ LIMIT 1 """); } - public override async Task HasFlag(bool async) + public override async Task HasFlag() { - await base.HasFlag(async); + await base.HasFlag(); AssertSql( """ @@ -271,9 +271,9 @@ LIMIT 1 """); } - public override async Task HasFlag_with_non_nullable_parameter(bool async) + public override async Task HasFlag_with_non_nullable_parameter() { - await base.HasFlag_with_non_nullable_parameter(async); + await base.HasFlag_with_non_nullable_parameter(); AssertSql( """ @@ -285,9 +285,9 @@ public override async Task HasFlag_with_non_nullable_parameter(bool async) """); } - public override async Task HasFlag_with_nullable_parameter(bool async) + public override async Task HasFlag_with_nullable_parameter() { - await base.HasFlag_with_nullable_parameter(async); + await base.HasFlag_with_nullable_parameter(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/GuidTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/GuidTranslationsNpgsqlTest.cs index e6b221cb84..60ea6ead02 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/GuidTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/GuidTranslationsNpgsqlTest.cs @@ -12,9 +12,9 @@ public GuidTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITestOut Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task New_with_constant(bool async) + public override async Task New_with_constant() { - await base.New_with_constant(async); + await base.New_with_constant(); AssertSql( """ @@ -24,9 +24,9 @@ public override async Task New_with_constant(bool async) """); } - public override async Task New_with_parameter(bool async) + public override async Task New_with_parameter() { - await base.New_with_parameter(async); + await base.New_with_parameter(); AssertSql( """ @@ -38,9 +38,9 @@ public override async Task New_with_parameter(bool async) """); } - public override async Task ToString_projection(bool async) + public override async Task ToString_projection() { - await base.ToString_projection(async); + await base.ToString_projection(); AssertSql( """ @@ -49,9 +49,9 @@ public override async Task ToString_projection(bool async) """); } - public override async Task NewGuid(bool async) + public override async Task NewGuid() { - await base.NewGuid(async); + await base.NewGuid(); if (TestEnvironment.PostgresVersion >= new Version(13, 0)) { @@ -73,12 +73,10 @@ WHERE uuid_generate_v4() <> '00000000-0000-0000-0000-000000000000' } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task CreateVersion7(bool async) + [ConditionalFact] + public virtual async Task CreateVersion7() { await AssertQuery( - async, ss => ss.Set() .Where(od => Guid.CreateVersion7() != default)); diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs index ddcae5fa76..36a6960e04 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public MathTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITestOut Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Abs_decimal(bool async) + public override async Task Abs_decimal() { - await base.Abs_decimal(async); + await base.Abs_decimal(); AssertSql( """ @@ -21,9 +21,9 @@ WHERE abs(b."Decimal") = 9.5 """); } - public override async Task Abs_int(bool async) + public override async Task Abs_int() { - await base.Abs_int(async); + await base.Abs_int(); AssertSql( """ @@ -33,9 +33,9 @@ WHERE abs(b."Int") = 9 """); } - public override async Task Abs_double(bool async) + public override async Task Abs_double() { - await base.Abs_double(async); + await base.Abs_double(); AssertSql( """ @@ -45,9 +45,9 @@ WHERE abs(b."Double") = 9.5 """); } - public override async Task Abs_float(bool async) + public override async Task Abs_float() { - await base.Abs_float(async); + await base.Abs_float(); AssertSql( """ @@ -57,9 +57,9 @@ WHERE abs(b."Float")::double precision = 9.5 """); } - public override async Task Ceiling(bool async) + public override async Task Ceiling() { - await base.Ceiling(async); + await base.Ceiling(); AssertSql( """ @@ -69,9 +69,9 @@ WHERE ceiling(b."Double") = 9.0 """); } - public override async Task Ceiling_float(bool async) + public override async Task Ceiling_float() { - await base.Ceiling_float(async); + await base.Ceiling_float(); AssertSql( """ @@ -81,9 +81,9 @@ WHERE ceiling(b."Float") = 9 """); } - public override async Task Floor_decimal(bool async) + public override async Task Floor_decimal() { - await base.Floor_decimal(async); + await base.Floor_decimal(); AssertSql( """ @@ -93,9 +93,9 @@ WHERE floor(b."Decimal") = 8.0 """); } - public override async Task Floor_double(bool async) + public override async Task Floor_double() { - await base.Floor_double(async); + await base.Floor_double(); AssertSql( """ @@ -105,9 +105,9 @@ WHERE floor(b."Double") = 8.0 """); } - public override async Task Floor_float(bool async) + public override async Task Floor_float() { - await base.Floor_float(async); + await base.Floor_float(); AssertSql( """ @@ -117,9 +117,9 @@ WHERE floor(b."Float") = 8 """); } - public override async Task Power(bool async) + public override async Task Power() { - await base.Power(async); + await base.Power(); AssertSql( """ @@ -129,9 +129,9 @@ WHERE power(b."Int"::double precision, 2.0) = 64.0 """); } - public override async Task Power_float(bool async) + public override async Task Power_float() { - await base.Power_float(async); + await base.Power_float(); AssertSql( """ @@ -141,9 +141,9 @@ WHERE power(b."Float", 2) > 73 AND power(b."Float", 2) < 74 """); } - public override async Task Round_decimal(bool async) + public override async Task Round_decimal() { - await base.Round_decimal(async); + await base.Round_decimal(); AssertSql( """ @@ -158,9 +158,9 @@ SELECT round(b."Decimal") """); } - public override async Task Round_double(bool async) + public override async Task Round_double() { - await base.Round_double(async); + await base.Round_double(); AssertSql( """ @@ -175,9 +175,9 @@ SELECT round(b."Double") """); } - public override async Task Round_float(bool async) + public override async Task Round_float() { - await base.Round_float(async); + await base.Round_float(); AssertSql( """ @@ -192,9 +192,9 @@ SELECT round(b."Float")::real """); } - public override async Task Round_with_digits_decimal(bool async) + public override async Task Round_with_digits_decimal() { - await base.Round_with_digits_decimal(async); + await base.Round_with_digits_decimal(); AssertSql( """ @@ -205,16 +205,16 @@ WHERE round(b."Decimal", 1) = 255.1 } // PostgreSQL only has round(v, s) over numeric, may be possible to cast back and forth though - public override Task Round_with_digits_double(bool async) - => AssertTranslationFailed(() => base.Round_with_digits_double(async)); + public override Task Round_with_digits_double() + => AssertTranslationFailed(() => base.Round_with_digits_double()); // PostgreSQL only has round(v, s) over numeric, may be possible to cast back and forth though - public override Task Round_with_digits_float(bool async) - => AssertTranslationFailed(() => base.Round_with_digits_float(async)); + public override Task Round_with_digits_float() + => AssertTranslationFailed(() => base.Round_with_digits_float()); - public override async Task Truncate_decimal(bool async) + public override async Task Truncate_decimal() { - await base.Truncate_decimal(async); + await base.Truncate_decimal(); AssertSql( """ @@ -229,9 +229,9 @@ SELECT trunc(b."Decimal") """); } - public override async Task Truncate_double(bool async) + public override async Task Truncate_double() { - await base.Truncate_double(async); + await base.Truncate_double(); AssertSql( """ @@ -246,9 +246,9 @@ SELECT trunc(b."Double") """); } - public override async Task Truncate_float(bool async) + public override async Task Truncate_float() { - await base.Truncate_float(async); + await base.Truncate_float(); AssertSql( """ @@ -263,9 +263,9 @@ SELECT trunc(b."Float")::real """); } - public override async Task Truncate_project_and_order_by_it_twice(bool async) + public override async Task Truncate_project_and_order_by_it_twice() { - await base.Truncate_project_and_order_by_it_twice(async); + await base.Truncate_project_and_order_by_it_twice(); AssertSql( """ @@ -281,9 +281,9 @@ ORDER BY trunc(b."Double") NULLS FIRST //FROM [Orders] AS [o] //WHERE [o].[OrderID] < 10250 //ORDER BY [A]"); - public override async Task Truncate_project_and_order_by_it_twice2(bool async) + public override async Task Truncate_project_and_order_by_it_twice2() { - await base.Truncate_project_and_order_by_it_twice2(async); + await base.Truncate_project_and_order_by_it_twice2(); AssertSql( """ @@ -299,9 +299,9 @@ ORDER BY trunc(b."Double") DESC NULLS LAST //FROM [Orders] AS [o] //WHERE [o].[OrderID] < 10250 //ORDER BY [A] DESC"); - public override async Task Truncate_project_and_order_by_it_twice3(bool async) + public override async Task Truncate_project_and_order_by_it_twice3() { - await base.Truncate_project_and_order_by_it_twice3(async); + await base.Truncate_project_and_order_by_it_twice3(); AssertSql( """ @@ -311,9 +311,9 @@ ORDER BY trunc(b."Double") DESC NULLS LAST """); } - public override async Task Exp(bool async) + public override async Task Exp() { - await base.Exp(async); + await base.Exp(); AssertSql( """ @@ -323,9 +323,9 @@ WHERE exp(b."Double") > 1.0 """); } - public override async Task Exp_float(bool async) + public override async Task Exp_float() { - await base.Exp_float(async); + await base.Exp_float(); AssertSql( """ @@ -335,9 +335,9 @@ WHERE exp(b."Float") > 1 """); } - public override async Task Log(bool async) + public override async Task Log() { - await base.Log(async); + await base.Log(); AssertSql( """ @@ -347,9 +347,9 @@ public override async Task Log(bool async) """); } - public override async Task Log_float(bool async) + public override async Task Log_float() { - await base.Log_float(async); + await base.Log_float(); AssertSql( """ @@ -360,16 +360,16 @@ public override async Task Log_float(bool async) } // PostgreSQL only has log(x, base) over numeric, may be possible to cast back and forth though - public override Task Log_with_newBase(bool async) - => AssertTranslationFailed(() => base.Log_with_newBase(async)); + public override Task Log_with_newBase() + => AssertTranslationFailed(() => base.Log_with_newBase()); // PostgreSQL only has log(x, base) over numeric, may be possible to cast back and forth though - public override Task Log_with_newBase_float(bool async) - => AssertTranslationFailed(() => base.Log_with_newBase_float(async)); + public override Task Log_with_newBase_float() + => AssertTranslationFailed(() => base.Log_with_newBase_float()); - public override async Task Log10(bool async) + public override async Task Log10() { - await base.Log10(async); + await base.Log10(); AssertSql( """ @@ -379,9 +379,9 @@ public override async Task Log10(bool async) """); } - public override async Task Log10_float(bool async) + public override async Task Log10_float() { - await base.Log10_float(async); + await base.Log10_float(); AssertSql( """ @@ -391,12 +391,12 @@ public override async Task Log10_float(bool async) """); } - public override async Task Log2(bool async) - => await AssertTranslationFailed(() => base.Log2(async)); + public override async Task Log2() + => await AssertTranslationFailed(() => base.Log2()); - public override async Task Sqrt(bool async) + public override async Task Sqrt() { - await base.Sqrt(async); + await base.Sqrt(); AssertSql( """ @@ -406,9 +406,9 @@ public override async Task Sqrt(bool async) """); } - public override async Task Sqrt_float(bool async) + public override async Task Sqrt_float() { - await base.Sqrt_float(async); + await base.Sqrt_float(); AssertSql( """ @@ -418,9 +418,9 @@ public override async Task Sqrt_float(bool async) """); } - public override async Task Sign(bool async) + public override async Task Sign() { - await base.Sign(async); + await base.Sign(); AssertSql( """ @@ -430,9 +430,9 @@ WHERE sign(b."Double")::int > 0 """); } - public override async Task Sign_float(bool async) + public override async Task Sign_float() { - await base.Sign_float(async); + await base.Sign_float(); AssertSql( """ @@ -442,9 +442,9 @@ WHERE sign(b."Float")::int > 0 """); } - public override async Task Max(bool async) + public override async Task Max() { - await base.Max(async); + await base.Max(); AssertSql( """ @@ -454,9 +454,9 @@ WHERE GREATEST(b."Int", b."Short" - 3) = b."Int" """); } - public override async Task Max_nested(bool async) + public override async Task Max_nested() { - await base.Max_nested(async); + await base.Max_nested(); AssertSql( """ @@ -466,9 +466,9 @@ WHERE GREATEST(b."Short" - 3, b."Int", 1) = b."Int" """); } - public override async Task Max_nested_twice(bool async) + public override async Task Max_nested_twice() { - await base.Max_nested_twice(async); + await base.Max_nested_twice(); AssertSql( """ @@ -478,9 +478,9 @@ WHERE GREATEST(1, b."Int", 2, b."Short" - 3) = b."Int" """); } - public override async Task Min(bool async) + public override async Task Min() { - await base.Min(async); + await base.Min(); AssertSql( """ @@ -490,9 +490,9 @@ WHERE LEAST(b."Int", b."Short" + 3) = b."Int" """); } - public override async Task Min_nested(bool async) + public override async Task Min_nested() { - await base.Min_nested(async); + await base.Min_nested(); AssertSql( """ @@ -502,9 +502,9 @@ WHERE LEAST(b."Short" + 3, b."Int", 99999) = b."Int" """); } - public override async Task Min_nested_twice(bool async) + public override async Task Min_nested_twice() { - await base.Min_nested_twice(async); + await base.Min_nested_twice(); AssertSql( """ @@ -514,9 +514,9 @@ WHERE LEAST(99999, b."Int", 99998, b."Short" + 3) = b."Int" """); } - public override async Task Degrees(bool async) + public override async Task Degrees() { - await base.Degrees(async); + await base.Degrees(); AssertSql( """ @@ -526,9 +526,9 @@ WHERE degrees(b."Double") > 0.0 """); } - public override async Task Degrees_float(bool async) + public override async Task Degrees_float() { - await base.Degrees_float(async); + await base.Degrees_float(); AssertSql( """ @@ -538,9 +538,9 @@ WHERE degrees(b."Float") > 0 """); } - public override async Task Radians(bool async) + public override async Task Radians() { - await base.Radians(async); + await base.Radians(); AssertSql( """ @@ -550,9 +550,9 @@ WHERE radians(b."Double") > 0.0 """); } - public override async Task Radians_float(bool async) + public override async Task Radians_float() { - await base.Radians_float(async); + await base.Radians_float(); AssertSql( """ @@ -564,9 +564,9 @@ WHERE radians(b."Float") > 0 #region Trigonometry - public override async Task Acos(bool async) + public override async Task Acos() { - await base.Acos(async); + await base.Acos(); AssertSql( """ @@ -576,9 +576,9 @@ public override async Task Acos(bool async) """); } - public override async Task Acos_float(bool async) + public override async Task Acos_float() { - await base.Acos_float(async); + await base.Acos_float(); AssertSql( """ @@ -588,12 +588,12 @@ public override async Task Acos_float(bool async) """); } - public override async Task Acosh(bool async) - => await AssertTranslationFailed(() => base.Acosh(async)); + public override async Task Acosh() + => await AssertTranslationFailed(() => base.Acosh()); - public override async Task Asin(bool async) + public override async Task Asin() { - await base.Asin(async); + await base.Asin(); AssertSql( """ @@ -603,9 +603,9 @@ public override async Task Asin(bool async) """); } - public override async Task Asin_float(bool async) + public override async Task Asin_float() { - await base.Asin_float(async); + await base.Asin_float(); AssertSql( """ @@ -615,12 +615,12 @@ public override async Task Asin_float(bool async) """); } - public override async Task Asinh(bool async) - => await AssertTranslationFailed(() => base.Asinh(async)); + public override async Task Asinh() + => await AssertTranslationFailed(() => base.Asinh()); - public override async Task Atan(bool async) + public override async Task Atan() { - await base.Atan(async); + await base.Atan(); AssertSql( """ @@ -630,9 +630,9 @@ WHERE atan(b."Double") > 0.0 """); } - public override async Task Atan_float(bool async) + public override async Task Atan_float() { - await base.Atan_float(async); + await base.Atan_float(); AssertSql( """ @@ -642,12 +642,12 @@ WHERE atan(b."Float") > 0 """); } - public override async Task Atanh(bool async) - => await AssertTranslationFailed(() => base.Atanh(async)); + public override async Task Atanh() + => await AssertTranslationFailed(() => base.Atanh()); - public override async Task Atan2(bool async) + public override async Task Atan2() { - await base.Atan2(async); + await base.Atan2(); AssertSql( """ @@ -657,9 +657,9 @@ WHERE atan2(b."Double", 1.0) > 0.0 """); } - public override async Task Atan2_float(bool async) + public override async Task Atan2_float() { - await base.Atan2_float(async); + await base.Atan2_float(); AssertSql( """ @@ -669,9 +669,9 @@ WHERE atan2(b."Float", 1) > 0 """); } - public override async Task Cos(bool async) + public override async Task Cos() { - await base.Cos(async); + await base.Cos(); AssertSql( """ @@ -681,9 +681,9 @@ WHERE cos(b."Double") > 0.0 """); } - public override async Task Cos_float(bool async) + public override async Task Cos_float() { - await base.Cos_float(async); + await base.Cos_float(); AssertSql( """ @@ -693,12 +693,12 @@ WHERE cos(b."Float") > 0 """); } - public override async Task Cosh(bool async) - => await AssertTranslationFailed(() => base.Cosh(async)); + public override async Task Cosh() + => await AssertTranslationFailed(() => base.Cosh()); - public override async Task Sin(bool async) + public override async Task Sin() { - await base.Sin(async); + await base.Sin(); AssertSql( """ @@ -708,9 +708,9 @@ WHERE sin(b."Double") > 0.0 """); } - public override async Task Sin_float(bool async) + public override async Task Sin_float() { - await base.Sin_float(async); + await base.Sin_float(); AssertSql( """ @@ -720,12 +720,12 @@ WHERE sin(b."Float") > 0 """); } - public override async Task Sinh(bool async) - => await AssertTranslationFailed(() => base.Sinh(async)); + public override async Task Sinh() + => await AssertTranslationFailed(() => base.Sinh()); - public override async Task Tan(bool async) + public override async Task Tan() { - await base.Tan(async); + await base.Tan(); AssertSql( """ @@ -735,9 +735,9 @@ WHERE tan(b."Double") > 0.0 """); } - public override async Task Tan_float(bool async) + public override async Task Tan_float() { - await base.Tan_float(async); + await base.Tan_float(); AssertSql( """ @@ -747,8 +747,8 @@ WHERE tan(b."Float") > 0 """); } - public override async Task Tanh(bool async) - => await AssertTranslationFailed(() => base.Tanh(async)); + public override async Task Tanh() + => await AssertTranslationFailed(() => base.Tanh()); #endregion Trigonometry diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.cs index 3de1395823..437f31dbde 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.cs @@ -13,9 +13,9 @@ public MiscellaneousTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, #region Random - public override async Task Random_on_EF_Functions(bool async) + public override async Task Random_on_EF_Functions() { - await base.Random_on_EF_Functions(async); + await base.Random_on_EF_Functions(); AssertSql( """ @@ -25,44 +25,44 @@ WHERE random() >= 0.0 AND random() < 1.0 """); } - public override async Task Random_Shared_Next_with_no_args(bool async) + public override async Task Random_Shared_Next_with_no_args() { - await base.Random_Shared_Next_with_no_args(async); + await base.Random_Shared_Next_with_no_args(); AssertSql(); } - public override async Task Random_Shared_Next_with_one_arg(bool async) + public override async Task Random_Shared_Next_with_one_arg() { - await base.Random_Shared_Next_with_one_arg(async); + await base.Random_Shared_Next_with_one_arg(); AssertSql(); } - public override async Task Random_Shared_Next_with_two_args(bool async) + public override async Task Random_Shared_Next_with_two_args() { - await base.Random_Shared_Next_with_two_args(async); + await base.Random_Shared_Next_with_two_args(); AssertSql(); } - public override async Task Random_new_Next_with_no_args(bool async) + public override async Task Random_new_Next_with_no_args() { - await base.Random_new_Next_with_no_args(async); + await base.Random_new_Next_with_no_args(); AssertSql(); } - public override async Task Random_new_Next_with_one_arg(bool async) + public override async Task Random_new_Next_with_one_arg() { - await base.Random_new_Next_with_one_arg(async); + await base.Random_new_Next_with_one_arg(); AssertSql(); } - public override async Task Random_new_Next_with_two_args(bool async) + public override async Task Random_new_Next_with_two_args() { - await base.Random_new_Next_with_two_args(async); + await base.Random_new_Next_with_two_args(); AssertSql(); } @@ -74,39 +74,39 @@ public override async Task Random_new_Next_with_two_args(bool async) // These tests convert (among other things) to and from boolean, which PostgreSQL // does not support (https://github.com/dotnet/efcore/issues/19606) - public override async Task Convert_ToBoolean(bool async) + public override async Task Convert_ToBoolean() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToBoolean(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToBoolean()); Assert.Equal("42846", exception.SqlState); } - public override async Task Convert_ToByte(bool async) + public override async Task Convert_ToByte() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToByte(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToByte()); Assert.Equal("42846", exception.SqlState); } - public override async Task Convert_ToDecimal(bool async) + public override async Task Convert_ToDecimal() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToDecimal(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToDecimal()); Assert.Equal("42846", exception.SqlState); } - public override async Task Convert_ToDouble(bool async) + public override async Task Convert_ToDouble() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToDouble(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToDouble()); Assert.Equal("42846", exception.SqlState); } - public override async Task Convert_ToInt16(bool async) + public override async Task Convert_ToInt16() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToInt16(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToInt16()); Assert.Equal("42846", exception.SqlState); } - public override async Task Convert_ToInt32(bool async) + public override async Task Convert_ToInt32() { - await base.Convert_ToInt32(async); + await base.Convert_ToInt32(); AssertSql( """ @@ -170,23 +170,23 @@ public override async Task Convert_ToInt32(bool async) """); } - public override async Task Convert_ToInt64(bool async) + public override async Task Convert_ToInt64() { - var exception = await Assert.ThrowsAsync(() => base.Convert_ToInt64(async)); + var exception = await Assert.ThrowsAsync(() => base.Convert_ToInt64()); Assert.Equal("42846", exception.SqlState); } // Convert on DateTime not yet supported - public override Task Convert_ToString(bool async) - => AssertTranslationFailed(() => base.Convert_ToString(async)); + public override Task Convert_ToString() + => AssertTranslationFailed(() => base.Convert_ToString()); #endregion Convert #region Compare - public override async Task Int_Compare_to_simple_zero(bool async) + public override async Task Int_Compare_to_simple_zero() { - await base.Int_Compare_to_simple_zero(async); + await base.Int_Compare_to_simple_zero(); AssertSql( """ @@ -238,7 +238,7 @@ WHERE b."Int" > @orderId """); } - public override async Task DateTime_Compare_to_simple_zero(bool async, bool compareTo) + public override async Task DateTime_Compare_to_simple_zero(bool compareTo) { // The base test implementation uses an Unspecified DateTime, which isn't supported with PostgreSQL timestamptz var dateTime = new DateTime(1998, 5, 4, 15, 30, 10, DateTimeKind.Utc); @@ -246,53 +246,41 @@ public override async Task DateTime_Compare_to_simple_zero(bool async, bool comp if (compareTo) { await AssertQuery( - async, ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) == 0)); await AssertQuery( - async, ss => ss.Set().Where(c => 0 != c.DateTime.CompareTo(dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) > 0)); await AssertQuery( - async, ss => ss.Set().Where(c => 0 >= c.DateTime.CompareTo(dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => 0 < c.DateTime.CompareTo(dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => c.DateTime.CompareTo(dateTime) <= 0)); } else { await AssertQuery( - async, ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) == 0)); await AssertQuery( - async, ss => ss.Set().Where(c => 0 != DateTime.Compare(c.DateTime, dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) > 0)); await AssertQuery( - async, ss => ss.Set().Where(c => 0 >= DateTime.Compare(c.DateTime, dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => 0 < DateTime.Compare(c.DateTime, dateTime))); await AssertQuery( - async, ss => ss.Set().Where(c => DateTime.Compare(c.DateTime, dateTime) <= 0)); } @@ -346,9 +334,9 @@ WHERE b."DateTime" > @dateTime """); } - public override async Task TimeSpan_Compare_to_simple_zero(bool async, bool compareTo) + public override async Task TimeSpan_Compare_to_simple_zero(bool compareTo) { - await base.TimeSpan_Compare_to_simple_zero(async, compareTo); + await base.TimeSpan_Compare_to_simple_zero(compareTo); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsNpgsqlTest.cs index 5b63342c11..2e6b37b066 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public ArithmeticOperatorTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fix Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Add(bool async) + public override async Task Add() { - await base.Add(async); + await base.Add(); AssertSql( """ @@ -21,9 +21,9 @@ public override async Task Add(bool async) """); } - public override async Task Subtract(bool async) + public override async Task Subtract() { - await base.Subtract(async); + await base.Subtract(); AssertSql( """ @@ -33,9 +33,9 @@ public override async Task Subtract(bool async) """); } - public override async Task Multiply(bool async) + public override async Task Multiply() { - await base.Multiply(async); + await base.Multiply(); AssertSql( """ @@ -45,9 +45,9 @@ public override async Task Multiply(bool async) """); } - public override async Task Modulo(bool async) + public override async Task Modulo() { - await base.Modulo(async); + await base.Modulo(); AssertSql( """ @@ -57,9 +57,9 @@ public override async Task Modulo(bool async) """); } - public override async Task Minus(bool async) + public override async Task Minus() { - await base.Minus(async); + await base.Minus(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsNpgsqlTest.cs index 56f7e6a5f5..a74825c27a 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public BitwiseOperatorTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixtur Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Or(bool async) + public override async Task Or() { - await base.Or(async); + await base.Or(); AssertSql( """ @@ -26,9 +26,9 @@ public override async Task Or(bool async) """); } - public override async Task Or_over_boolean(bool async) + public override async Task Or_over_boolean() { - await base.Or_over_boolean(async); + await base.Or_over_boolean(); AssertSql( """ @@ -43,9 +43,9 @@ public override async Task Or_over_boolean(bool async) """); } - public override async Task Or_multiple(bool async) + public override async Task Or_multiple() { - await base.Or_multiple(async); + await base.Or_multiple(); AssertSql( """ @@ -55,9 +55,9 @@ WHERE CAST(b."Int" | b."Short" AS bigint) | b."Long" = 7 """); } - public override async Task And(bool async) + public override async Task And() { - await base.And(async); + await base.And(); AssertSql( """ @@ -72,9 +72,9 @@ SELECT b."Int" & b."Short" """); } - public override async Task And_over_boolean(bool async) + public override async Task And_over_boolean() { - await base.And_over_boolean(async); + await base.And_over_boolean(); AssertSql( """ @@ -89,9 +89,9 @@ public override async Task And_over_boolean(bool async) """); } - public override async Task Xor(bool async) + public override async Task Xor() { - await base.Xor(async); + await base.Xor(); AssertSql( """ @@ -106,9 +106,9 @@ SELECT b."Int" # b."Short" """); } - public override async Task Xor_over_boolean(bool async) + public override async Task Xor_over_boolean() { - await base.Xor_over_boolean(async); + await base.Xor_over_boolean(); AssertSql( """ @@ -118,9 +118,9 @@ public override async Task Xor_over_boolean(bool async) """); } - public override async Task Complement(bool async) + public override async Task Complement() { - await base.Complement(async); + await base.Complement(); AssertSql( """ @@ -130,9 +130,9 @@ public override async Task Complement(bool async) """); } - public override async Task And_or_over_boolean(bool async) + public override async Task And_or_over_boolean() { - await base.And_or_over_boolean(async); + await base.And_or_over_boolean(); AssertSql( """ @@ -142,9 +142,9 @@ public override async Task And_or_over_boolean(bool async) """); } - public override async Task Or_with_logical_or(bool async) + public override async Task Or_with_logical_or() { - await base.Or_with_logical_or(async); + await base.Or_with_logical_or(); AssertSql( """ @@ -154,9 +154,9 @@ public override async Task Or_with_logical_or(bool async) """); } - public override async Task And_with_logical_and(bool async) + public override async Task And_with_logical_and() { - await base.And_with_logical_and(async); + await base.And_with_logical_and(); AssertSql( """ @@ -166,9 +166,9 @@ public override async Task And_with_logical_and(bool async) """); } - public override async Task Or_with_logical_and(bool async) + public override async Task Or_with_logical_and() { - await base.Or_with_logical_and(async); + await base.Or_with_logical_and(); AssertSql( """ @@ -178,9 +178,9 @@ public override async Task Or_with_logical_and(bool async) """); } - public override async Task And_with_logical_or(bool async) + public override async Task And_with_logical_or() { - await base.And_with_logical_or(async); + await base.And_with_logical_or(); AssertSql( """ @@ -190,11 +190,11 @@ public override async Task And_with_logical_or(bool async) """); } - public override Task Left_shift(bool async) - => AssertTranslationFailed(() => base.Left_shift(async)); + public override Task Left_shift() + => AssertTranslationFailed(() => base.Left_shift()); - public override Task Right_shift(bool async) - => AssertTranslationFailed(() => base.Right_shift(async)); + public override Task Right_shift() + => AssertTranslationFailed(() => base.Right_shift()); [ConditionalFact] public virtual void Check_all_tests_overridden() diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsNpgsqlTest.cs index b92a596cd0..b61a1fceaf 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public ComparisonOperatorTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fix Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Equal(bool async) + public override async Task Equal() { - await base.Equal(async); + await base.Equal(); AssertSql( """ @@ -21,9 +21,9 @@ public override async Task Equal(bool async) """); } - public override async Task NotEqual(bool async) + public override async Task NotEqual() { - await base.NotEqual(async); + await base.NotEqual(); AssertSql( """ @@ -33,9 +33,9 @@ WHERE b."Int" <> 8 """); } - public override async Task GreaterThan(bool async) + public override async Task GreaterThan() { - await base.GreaterThan(async); + await base.GreaterThan(); AssertSql( """ @@ -45,9 +45,9 @@ WHERE b."Int" > 8 """); } - public override async Task GreaterThanOrEqual(bool async) + public override async Task GreaterThanOrEqual() { - await base.GreaterThanOrEqual(async); + await base.GreaterThanOrEqual(); AssertSql( """ @@ -57,9 +57,9 @@ public override async Task GreaterThanOrEqual(bool async) """); } - public override async Task LessThan(bool async) + public override async Task LessThan() { - await base.LessThan(async); + await base.LessThan(); AssertSql( """ @@ -69,9 +69,9 @@ WHERE b."Int" < 8 """); } - public override async Task LessThanOrEqual(bool async) + public override async Task LessThanOrEqual() { - await base.LessThanOrEqual(async); + await base.LessThanOrEqual(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsNpgsqlTest.cs index 44d9a44d31..3373a0e644 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public LogicalOperatorTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixtur Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task And(bool async) + public override async Task And() { - await base.And(async); + await base.And(); AssertSql( """ @@ -21,9 +21,9 @@ public override async Task And(bool async) """); } - public override async Task And_with_bool_property(bool async) + public override async Task And_with_bool_property() { - await base.And_with_bool_property(async); + await base.And_with_bool_property(); AssertSql( """ @@ -33,9 +33,9 @@ public override async Task And_with_bool_property(bool async) """); } - public override async Task Or(bool async) + public override async Task Or() { - await base.Or(async); + await base.Or(); AssertSql( """ @@ -45,9 +45,9 @@ public override async Task Or(bool async) """); } - public override async Task Or_with_bool_property(bool async) + public override async Task Or_with_bool_property() { - await base.Or_with_bool_property(async); + await base.Or_with_bool_property(); AssertSql( """ @@ -57,9 +57,9 @@ public override async Task Or_with_bool_property(bool async) """); } - public override async Task Not(bool async) + public override async Task Not() { - await base.Not(async); + await base.Not(); AssertSql( """ @@ -69,9 +69,9 @@ WHERE b."Int" <> 999 """); } - public override async Task Not_with_bool_property(bool async) + public override async Task Not_with_bool_property() { - await base.Not_with_bool_property(async); + await base.Not_with_bool_property(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsNpgsqlTest.cs index 4ef98ce76d..2522f98aca 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public MiscellaneousOperatorTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Conditional(bool async) + public override async Task Conditional() { - await base.Conditional(async); + await base.Conditional(); AssertSql( """ @@ -24,9 +24,9 @@ WHERE CASE """); } - public override async Task Coalesce(bool async) + public override async Task Coalesce() { - await base.Coalesce(async); + await base.Coalesce(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/StringTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/StringTranslationsNpgsqlTest.cs index af2eb65142..2ebc6fb97b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/StringTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/StringTranslationsNpgsqlTest.cs @@ -13,9 +13,9 @@ public StringTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITestO #region Equals - public override async Task Equals(bool async) + public override async Task Equals() { - await base.Equals(async); + await base.Equals(); AssertSql( """ @@ -25,23 +25,23 @@ public override async Task Equals(bool async) """); } - public override async Task Equals_with_OrdinalIgnoreCase(bool async) + public override async Task Equals_with_OrdinalIgnoreCase() { - await base.Equals_with_OrdinalIgnoreCase(async); + await base.Equals_with_OrdinalIgnoreCase(); AssertSql(); } - public override async Task Equals_with_Ordinal(bool async) + public override async Task Equals_with_Ordinal() { - await base.Equals_with_Ordinal(async); + await base.Equals_with_Ordinal(); AssertSql(); } - public override async Task Static_Equals(bool async) + public override async Task Static_Equals() { - await base.Static_Equals(async); + await base.Static_Equals(); AssertSql( """ @@ -51,16 +51,16 @@ public override async Task Static_Equals(bool async) """); } - public override async Task Static_Equals_with_OrdinalIgnoreCase(bool async) + public override async Task Static_Equals_with_OrdinalIgnoreCase() { - await base.Static_Equals_with_OrdinalIgnoreCase(async); + await base.Static_Equals_with_OrdinalIgnoreCase(); AssertSql(); } - public override async Task Static_Equals_with_Ordinal(bool async) + public override async Task Static_Equals_with_Ordinal() { - await base.Static_Equals_with_Ordinal(async); + await base.Static_Equals_with_Ordinal(); AssertSql(); } @@ -69,9 +69,9 @@ public override async Task Static_Equals_with_Ordinal(bool async) #region Miscellaneous - public override async Task Length(bool async) + public override async Task Length() { - await base.Length(async); + await base.Length(); AssertSql( """ @@ -81,9 +81,9 @@ WHERE length(b."String")::int = 7 """); } - public override async Task ToUpper(bool async) + public override async Task ToUpper() { - await base.ToUpper(async); + await base.ToUpper(); AssertSql( """ @@ -98,9 +98,9 @@ SELECT upper(b."String") """); } - public override async Task ToLower(bool async) + public override async Task ToLower() { - await base.ToLower(async); + await base.ToLower(); AssertSql( """ @@ -119,9 +119,9 @@ SELECT lower(b."String") #region IndexOf - public override async Task IndexOf(bool async) + public override async Task IndexOf() { - await base.IndexOf(async); + await base.IndexOf(); AssertSql( """ @@ -132,12 +132,12 @@ WHERE strpos(b."String", 'eattl') - 1 <> -1 } // TODO: #3547 - public override Task IndexOf_Char(bool async) - => Assert.ThrowsAsync(() => base.IndexOf_Char(async)); + public override Task IndexOf_Char() + => Assert.ThrowsAsync(() => base.IndexOf_Char()); - public override async Task IndexOf_with_empty_string(bool async) + public override async Task IndexOf_with_empty_string() { - await base.IndexOf_with_empty_string(async); + await base.IndexOf_with_empty_string(); AssertSql( """ @@ -147,9 +147,9 @@ WHERE strpos(b."String", '') - 1 = 0 """); } - public override async Task IndexOf_with_one_parameter_arg(bool async) + public override async Task IndexOf_with_one_parameter_arg() { - await base.IndexOf_with_one_parameter_arg(async); + await base.IndexOf_with_one_parameter_arg(); AssertSql( """ @@ -161,9 +161,9 @@ WHERE strpos(b."String", @pattern) - 1 = 1 """); } - public override async Task IndexOf_with_one_parameter_arg_char(bool async) + public override async Task IndexOf_with_one_parameter_arg_char() { - await base.IndexOf_with_one_parameter_arg_char(async); + await base.IndexOf_with_one_parameter_arg_char(); AssertSql( """ @@ -176,24 +176,24 @@ WHERE strpos(b."String", @pattern) - 1 = 1 } // PostgreSQL does not have strpos with starting position - public override Task IndexOf_with_constant_starting_position(bool async) - => AssertTranslationFailed(() => base.IndexOf_with_constant_starting_position(async)); + public override Task IndexOf_with_constant_starting_position() + => AssertTranslationFailed(() => base.IndexOf_with_constant_starting_position()); // PostgreSQL does not have strpos with starting position - public override Task IndexOf_with_constant_starting_position_char(bool async) - => AssertTranslationFailed(() => base.IndexOf_with_constant_starting_position_char(async)); + public override Task IndexOf_with_constant_starting_position_char() + => AssertTranslationFailed(() => base.IndexOf_with_constant_starting_position_char()); // PostgreSQL does not have strpos with starting position - public override Task IndexOf_with_parameter_starting_position(bool async) - => AssertTranslationFailed(() => base.IndexOf_with_parameter_starting_position(async)); + public override Task IndexOf_with_parameter_starting_position() + => AssertTranslationFailed(() => base.IndexOf_with_parameter_starting_position()); // PostgreSQL does not have strpos with starting position - public override Task IndexOf_with_parameter_starting_position_char(bool async) - => AssertTranslationFailed(() => base.IndexOf_with_parameter_starting_position_char(async)); + public override Task IndexOf_with_parameter_starting_position_char() + => AssertTranslationFailed(() => base.IndexOf_with_parameter_starting_position_char()); - public override async Task IndexOf_after_ToString(bool async) + public override async Task IndexOf_after_ToString() { - await base.IndexOf_after_ToString(async); + await base.IndexOf_after_ToString(); AssertSql( """ @@ -203,9 +203,9 @@ WHERE strpos(b."Int"::text, '55') - 1 = 1 """); } - public override async Task IndexOf_over_ToString(bool async) + public override async Task IndexOf_over_ToString() { - await base.IndexOf_over_ToString(async); + await base.IndexOf_over_ToString(); AssertSql( """ @@ -219,9 +219,9 @@ WHERE strpos('12559', b."Int"::text) - 1 = 1 #region Replace - public override async Task Replace(bool async) + public override async Task Replace() { - await base.Replace(async); + await base.Replace(); AssertSql( """ @@ -232,12 +232,12 @@ WHERE replace(b."String", 'Sea', 'Rea') = 'Reattle' } // TODO: #3547 - public override Task Replace_Char(bool async) - => AssertTranslationFailed(() => base.Replace_Char(async)); + public override Task Replace_Char() + => AssertTranslationFailed(() => base.Replace_Char()); - public override async Task Replace_with_empty_string(bool async) + public override async Task Replace_with_empty_string() { - await base.Replace_with_empty_string(async); + await base.Replace_with_empty_string(); AssertSql( """ @@ -247,9 +247,9 @@ public override async Task Replace_with_empty_string(bool async) """); } - public override async Task Replace_using_property_arguments(bool async) + public override async Task Replace_using_property_arguments() { - await base.Replace_using_property_arguments(async); + await base.Replace_using_property_arguments(); AssertSql( """ @@ -263,9 +263,9 @@ public override async Task Replace_using_property_arguments(bool async) #region Substring - public override async Task Substring(bool async) + public override async Task Substring() { - await base.Substring(async); + await base.Substring(); AssertSql( """ @@ -275,9 +275,9 @@ WHERE length(b."String")::int >= 3 AND substring(b."String", 2, 2) = 'ea' """); } - public override async Task Substring_with_one_arg_with_zero_startIndex(bool async) + public override async Task Substring_with_one_arg_with_zero_startIndex() { - await base.Substring_with_one_arg_with_zero_startIndex(async); + await base.Substring_with_one_arg_with_zero_startIndex(); AssertSql( """ @@ -287,9 +287,9 @@ WHERE substring(b."String", 1) = 'Seattle' """); } - public override async Task Substring_with_one_arg_with_constant(bool async) + public override async Task Substring_with_one_arg_with_constant() { - await base.Substring_with_one_arg_with_constant(async); + await base.Substring_with_one_arg_with_constant(); AssertSql( """ @@ -299,9 +299,9 @@ WHERE length(b."String")::int >= 1 AND substring(b."String", 2) = 'eattle' """); } - public override async Task Substring_with_one_arg_with_parameter(bool async) + public override async Task Substring_with_one_arg_with_parameter() { - await base.Substring_with_one_arg_with_parameter(async); + await base.Substring_with_one_arg_with_parameter(); AssertSql( """ @@ -313,9 +313,9 @@ WHERE length(b."String")::int >= 2 AND substring(b."String", @start + 1) = 'attl """); } - public override async Task Substring_with_two_args_with_zero_startIndex(bool async) + public override async Task Substring_with_two_args_with_zero_startIndex() { - await base.Substring_with_two_args_with_zero_startIndex(async); + await base.Substring_with_two_args_with_zero_startIndex(); AssertSql( """ @@ -325,9 +325,9 @@ WHERE length(b."String")::int >= 3 AND substring(b."String", 1, 3) = 'Sea' """); } - public override async Task Substring_with_two_args_with_zero_length(bool async) + public override async Task Substring_with_two_args_with_zero_length() { - await base.Substring_with_two_args_with_zero_length(async); + await base.Substring_with_two_args_with_zero_length(); AssertSql( """ @@ -337,9 +337,9 @@ WHERE length(b."String")::int >= 2 AND substring(b."String", 3, 0) = '' """); } - public override async Task Substring_with_two_args_with_parameter(bool async) + public override async Task Substring_with_two_args_with_parameter() { - await base.Substring_with_two_args_with_parameter(async); + await base.Substring_with_two_args_with_parameter(); AssertSql( """ @@ -351,9 +351,9 @@ WHERE length(b."String")::int >= 5 AND substring(b."String", @start + 1, 3) = 'a """); } - public override async Task Substring_with_two_args_with_IndexOf(bool async) + public override async Task Substring_with_two_args_with_IndexOf() { - await base.Substring_with_two_args_with_IndexOf(async); + await base.Substring_with_two_args_with_IndexOf(); AssertSql( """ @@ -367,9 +367,9 @@ public override async Task Substring_with_two_args_with_IndexOf(bool async) #region IsNullOrEmpty/Whitespace - public override async Task IsNullOrEmpty(bool async) + public override async Task IsNullOrEmpty() { - await base.IsNullOrEmpty(async); + await base.IsNullOrEmpty(); AssertSql( """ @@ -384,9 +384,9 @@ public override async Task IsNullOrEmpty(bool async) """); } - public override async Task IsNullOrEmpty_negated(bool async) + public override async Task IsNullOrEmpty_negated() { - await base.IsNullOrEmpty_negated(async); + await base.IsNullOrEmpty_negated(); AssertSql( """ @@ -401,9 +401,9 @@ SELECT n."String" IS NOT NULL AND n."String" <> '' """); } - public override async Task IsNullOrWhiteSpace(bool async) + public override async Task IsNullOrWhiteSpace() { - await base.IsNullOrWhiteSpace(async); + await base.IsNullOrWhiteSpace(); AssertSql( """ @@ -417,9 +417,9 @@ WHERE btrim(b."String", E' \t\n\r') = '' #region StartsWith - public override async Task StartsWith_Literal(bool async) + public override async Task StartsWith_Literal() { - await base.StartsWith_Literal(async); + await base.StartsWith_Literal(); AssertSql( """ @@ -430,12 +430,12 @@ WHERE b."String" LIKE 'Se%' } // TODO: #3547 - public override Task StartsWith_Literal_Char(bool async) - => AssertTranslationFailed(() => base.StartsWith_Literal_Char(async)); + public override Task StartsWith_Literal_Char() + => AssertTranslationFailed(() => base.StartsWith_Literal_Char()); - public override async Task StartsWith_Parameter(bool async) + public override async Task StartsWith_Parameter() { - await base.StartsWith_Parameter(async); + await base.StartsWith_Parameter(); AssertSql( """ @@ -447,12 +447,12 @@ WHERE b."String" LIKE @pattern_startswith """); } - public override Task StartsWith_Parameter_Char(bool async) - => AssertTranslationFailed(() => base.StartsWith_Parameter_Char(async)); + public override Task StartsWith_Parameter_Char() + => AssertTranslationFailed(() => base.StartsWith_Parameter_Char()); - public override async Task StartsWith_Column(bool async) + public override async Task StartsWith_Column() { - await base.StartsWith_Column(async); + await base.StartsWith_Column(); AssertSql( """ @@ -462,23 +462,23 @@ WHERE left(b."String", length(b."String")) = b."String" """); } - public override async Task StartsWith_with_StringComparison_Ordinal(bool async) + public override async Task StartsWith_with_StringComparison_Ordinal() { - await base.StartsWith_with_StringComparison_Ordinal(async); + await base.StartsWith_with_StringComparison_Ordinal(); AssertSql(); } - public override async Task StartsWith_with_StringComparison_OrdinalIgnoreCase(bool async) + public override async Task StartsWith_with_StringComparison_OrdinalIgnoreCase() { - await base.StartsWith_with_StringComparison_OrdinalIgnoreCase(async); + await base.StartsWith_with_StringComparison_OrdinalIgnoreCase(); AssertSql(); } - public override async Task StartsWith_with_StringComparison_unsupported(bool async) + public override async Task StartsWith_with_StringComparison_unsupported() { - await base.StartsWith_with_StringComparison_unsupported(async); + await base.StartsWith_with_StringComparison_unsupported(); AssertSql(); } @@ -487,9 +487,9 @@ public override async Task StartsWith_with_StringComparison_unsupported(bool asy #region EndsWith - public override async Task EndsWith_Literal(bool async) + public override async Task EndsWith_Literal() { - await base.EndsWith_Literal(async); + await base.EndsWith_Literal(); AssertSql( """ @@ -500,12 +500,12 @@ WHERE b."String" LIKE '%le' } // TODO: #3547 - public override Task EndsWith_Literal_Char(bool async) - => AssertTranslationFailed(() => base.EndsWith_Literal_Char(async)); + public override Task EndsWith_Literal_Char() + => AssertTranslationFailed(() => base.EndsWith_Literal_Char()); - public override async Task EndsWith_Parameter(bool async) + public override async Task EndsWith_Parameter() { - await base.EndsWith_Parameter(async); + await base.EndsWith_Parameter(); AssertSql( """ @@ -518,15 +518,14 @@ WHERE b."String" LIKE @pattern_endswith } // TODO: #3547 - public override Task EndsWith_Parameter_Char(bool async) - => AssertTranslationFailed(() => base.EndsWith_Parameter_Char(async)); + public override Task EndsWith_Parameter_Char() + => AssertTranslationFailed(() => base.EndsWith_Parameter_Char()); - public override async Task EndsWith_Column(bool async) + public override async Task EndsWith_Column() { // SQL Server trims trailing whitespace for length calculations, making our EndsWith() column translation not work reliably in that // case await AssertQuery( - async, ss => ss.Set().Where(b => b.String == "Seattle" && b.String.EndsWith(b.String))); AssertSql( @@ -537,23 +536,23 @@ await AssertQuery( """); } - public override async Task EndsWith_with_StringComparison_Ordinal(bool async) + public override async Task EndsWith_with_StringComparison_Ordinal() { - await base.EndsWith_with_StringComparison_Ordinal(async); + await base.EndsWith_with_StringComparison_Ordinal(); AssertSql(); } - public override async Task EndsWith_with_StringComparison_OrdinalIgnoreCase(bool async) + public override async Task EndsWith_with_StringComparison_OrdinalIgnoreCase() { - await base.EndsWith_with_StringComparison_OrdinalIgnoreCase(async); + await base.EndsWith_with_StringComparison_OrdinalIgnoreCase(); AssertSql(); } - public override async Task EndsWith_with_StringComparison_unsupported(bool async) + public override async Task EndsWith_with_StringComparison_unsupported() { - await base.EndsWith_with_StringComparison_unsupported(async); + await base.EndsWith_with_StringComparison_unsupported(); AssertSql(); } @@ -562,10 +561,9 @@ public override async Task EndsWith_with_StringComparison_unsupported(bool async #region Contains - public override async Task Contains_Literal(bool async) + public override async Task Contains_Literal() { await AssertQuery( - async, ss => ss.Set().Where(c => c.String.Contains("eattl")), // SQL Server is case-insensitive by default ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.OrdinalIgnoreCase))); @@ -578,12 +576,12 @@ WHERE b."String" LIKE '%eattl%' } // TODO: #3547 - public override Task Contains_Literal_Char(bool async) - => AssertTranslationFailed(() => base.Contains_Literal_Char(async)); + public override Task Contains_Literal_Char() + => AssertTranslationFailed(() => base.Contains_Literal_Char()); - public override async Task Contains_Column(bool async) + public override async Task Contains_Column() { - await base.Contains_Column(async); + await base.Contains_Column(); AssertSql( """ @@ -598,9 +596,9 @@ SELECT strpos(b."String", b."String") > 0 """); } - public override async Task Contains_negated(bool async) + public override async Task Contains_negated() { - await base.Contains_negated(async); + await base.Contains_negated(); AssertSql( """ @@ -615,30 +613,30 @@ SELECT b."String" NOT LIKE '%eattle%' """); } - public override async Task Contains_with_StringComparison_Ordinal(bool async) + public override async Task Contains_with_StringComparison_Ordinal() { - await base.Contains_with_StringComparison_Ordinal(async); + await base.Contains_with_StringComparison_Ordinal(); AssertSql(); } - public override async Task Contains_with_StringComparison_OrdinalIgnoreCase(bool async) + public override async Task Contains_with_StringComparison_OrdinalIgnoreCase() { - await base.Contains_with_StringComparison_OrdinalIgnoreCase(async); + await base.Contains_with_StringComparison_OrdinalIgnoreCase(); AssertSql(); } - public override async Task Contains_with_StringComparison_unsupported(bool async) + public override async Task Contains_with_StringComparison_unsupported() { - await base.Contains_with_StringComparison_unsupported(async); + await base.Contains_with_StringComparison_unsupported(); AssertSql(); } - public override async Task Contains_constant_with_whitespace(bool async) + public override async Task Contains_constant_with_whitespace() { - await base.Contains_constant_with_whitespace(async); + await base.Contains_constant_with_whitespace(); AssertSql( """ @@ -648,9 +646,9 @@ WHERE b."String" LIKE '% %' """); } - public override async Task Contains_parameter_with_whitespace(bool async) + public override async Task Contains_parameter_with_whitespace() { - await base.Contains_parameter_with_whitespace(async); + await base.Contains_parameter_with_whitespace(); AssertSql( """ @@ -666,9 +664,9 @@ WHERE b."String" LIKE @pattern_contains #region TrimStart - public override async Task TrimStart_without_arguments(bool async) + public override async Task TrimStart_without_arguments() { - await base.TrimStart_without_arguments(async); + await base.TrimStart_without_arguments(); AssertSql( """ @@ -678,9 +676,9 @@ WHERE ltrim(b."String", E' \t\n\r') = 'Boston ' """); } - public override async Task TrimStart_with_char_argument(bool async) + public override async Task TrimStart_with_char_argument() { - await base.TrimStart_with_char_argument(async); + await base.TrimStart_with_char_argument(); AssertSql( """ @@ -690,9 +688,9 @@ WHERE ltrim(b."String", 'S') = 'eattle' """); } - public override async Task TrimStart_with_char_array_argument(bool async) + public override async Task TrimStart_with_char_array_argument() { - await base.TrimStart_with_char_array_argument(async); + await base.TrimStart_with_char_array_argument(); AssertSql( """ @@ -706,9 +704,9 @@ WHERE ltrim(b."String", 'Se') = 'attle' #region TrimEnd - public override async Task TrimEnd_without_arguments(bool async) + public override async Task TrimEnd_without_arguments() { - await base.TrimEnd_without_arguments(async); + await base.TrimEnd_without_arguments(); AssertSql( """ @@ -718,9 +716,9 @@ WHERE rtrim(b."String", E' \t\n\r') = ' Boston' """); } - public override async Task TrimEnd_with_char_argument(bool async) + public override async Task TrimEnd_with_char_argument() { - await base.TrimEnd_with_char_argument(async); + await base.TrimEnd_with_char_argument(); AssertSql( """ @@ -730,9 +728,9 @@ WHERE rtrim(b."String", 'e') = 'Seattl' """); } - public override async Task TrimEnd_with_char_array_argument(bool async) + public override async Task TrimEnd_with_char_array_argument() { - await base.TrimEnd_with_char_array_argument(async); + await base.TrimEnd_with_char_array_argument(); AssertSql( """ @@ -746,9 +744,9 @@ WHERE rtrim(b."String", 'le') = 'Seatt' #region Trim - public override async Task Trim_without_argument_in_predicate(bool async) + public override async Task Trim_without_argument_in_predicate() { - await base.Trim_without_argument_in_predicate(async); + await base.Trim_without_argument_in_predicate(); AssertSql( """ @@ -758,9 +756,9 @@ WHERE btrim(b."String", E' \t\n\r') = 'Boston' """); } - public override async Task Trim_with_char_argument_in_predicate(bool async) + public override async Task Trim_with_char_argument_in_predicate() { - await base.Trim_with_char_argument_in_predicate(async); + await base.Trim_with_char_argument_in_predicate(); AssertSql( """ @@ -770,9 +768,9 @@ WHERE btrim(b."String", 'S') = 'eattle' """); } - public override async Task Trim_with_char_array_argument_in_predicate(bool async) + public override async Task Trim_with_char_array_argument_in_predicate() { - await base.Trim_with_char_array_argument_in_predicate(async); + await base.Trim_with_char_array_argument_in_predicate(); AssertSql( """ @@ -786,9 +784,9 @@ WHERE btrim(b."String", 'Se') = 'attl' #region Compare - public override async Task Compare_simple_zero(bool async) + public override async Task Compare_simple_zero() { - await base.Compare_simple_zero(async); + await base.Compare_simple_zero(); AssertSql( """ @@ -828,9 +826,9 @@ WHERE b."String" > 'Seattle' """); } - public override async Task Compare_simple_one(bool async) + public override async Task Compare_simple_one() { - await base.Compare_simple_one(async); + await base.Compare_simple_one(); AssertSql( """ @@ -870,9 +868,9 @@ WHERE b."String" < 'Seattle' """); } - public override async Task Compare_with_parameter(bool async) + public override async Task Compare_with_parameter() { - await base.Compare_with_parameter(async); + await base.Compare_with_parameter(); AssertSql( """ @@ -924,9 +922,9 @@ WHERE b."String" < @basicTypeEntity_String """); } - public override async Task Compare_simple_more_than_one(bool async) + public override async Task Compare_simple_more_than_one() { - await base.Compare_simple_more_than_one(async); + await base.Compare_simple_more_than_one(); AssertSql( """ @@ -960,9 +958,9 @@ WHEN b."String" < 'Seattle' THEN -1 """); } - public override async Task Compare_nested(bool async) + public override async Task Compare_nested() { - await base.Compare_nested(async); + await base.Compare_nested(); AssertSql( """ @@ -1002,9 +1000,9 @@ public override async Task Compare_nested(bool async) """); } - public override async Task Compare_multi_predicate(bool async) + public override async Task Compare_multi_predicate() { - await base.Compare_multi_predicate(async); + await base.Compare_multi_predicate(); AssertSql( """ @@ -1014,9 +1012,9 @@ public override async Task Compare_multi_predicate(bool async) """); } - public override async Task CompareTo_simple_zero(bool async) + public override async Task CompareTo_simple_zero() { - await base.CompareTo_simple_zero(async); + await base.CompareTo_simple_zero(); AssertSql( """ @@ -1056,9 +1054,9 @@ WHERE b."String" > 'Seattle' """); } - public override async Task CompareTo_simple_one(bool async) + public override async Task CompareTo_simple_one() { - await base.CompareTo_simple_one(async); + await base.CompareTo_simple_one(); AssertSql( """ @@ -1098,9 +1096,9 @@ WHERE b."String" < 'Seattle' """); } - public override async Task CompareTo_with_parameter(bool async) + public override async Task CompareTo_with_parameter() { - await base.CompareTo_with_parameter(async); + await base.CompareTo_with_parameter(); AssertSql( """ @@ -1152,9 +1150,9 @@ WHERE b."String" < @basicTypesEntity_String """); } - public override async Task CompareTo_simple_more_than_one(bool async) + public override async Task CompareTo_simple_more_than_one() { - await base.CompareTo_simple_more_than_one(async); + await base.CompareTo_simple_more_than_one(); AssertSql( """ @@ -1188,9 +1186,9 @@ WHEN b."String" < 'Seattle' THEN -1 """); } - public override async Task CompareTo_nested(bool async) + public override async Task CompareTo_nested() { - await base.CompareTo_nested(async); + await base.CompareTo_nested(); AssertSql( """ @@ -1230,9 +1228,9 @@ public override async Task CompareTo_nested(bool async) """); } - public override async Task Compare_to_multi_predicate(bool async) + public override async Task Compare_to_multi_predicate() { - await base.Compare_to_multi_predicate(async); + await base.Compare_to_multi_predicate(); AssertSql( """ @@ -1246,9 +1244,9 @@ public override async Task Compare_to_multi_predicate(bool async) #region Join - public override async Task Join_over_non_nullable_column(bool async) + public override async Task Join_over_non_nullable_column() { - await base.Join_over_non_nullable_column(async); + await base.Join_over_non_nullable_column(); AssertSql( """ @@ -1258,9 +1256,9 @@ GROUP BY b."Int" """); } - public override async Task Join_over_nullable_column(bool async) + public override async Task Join_over_nullable_column() { - await base.Join_over_nullable_column(async); + await base.Join_over_nullable_column(); AssertSql( """ @@ -1273,9 +1271,9 @@ GROUP BY n0."Key" """); } - public override async Task Join_with_predicate(bool async) + public override async Task Join_with_predicate() { - await base.Join_with_predicate(async); + await base.Join_with_predicate(); AssertSql( """ @@ -1285,9 +1283,9 @@ GROUP BY b."Int" """); } - public override async Task Join_with_ordering(bool async) + public override async Task Join_with_ordering() { - await base.Join_with_ordering(async); + await base.Join_with_ordering(); AssertSql( """ @@ -1297,9 +1295,9 @@ GROUP BY b."Int" """); } - public override async Task Join_non_aggregate(bool async) + public override async Task Join_non_aggregate() { - await base.Join_non_aggregate(async); + await base.Join_non_aggregate(); AssertSql( """ @@ -1315,9 +1313,9 @@ WHERE concat_ws('|', b."String", @foo, '', 'bar') = 'Seattle|foo||bar' #region Concatenation - public override async Task Concat_operator(bool async) + public override async Task Concat_operator() { - await base.Concat_operator(async); + await base.Concat_operator(); AssertSql( """ @@ -1327,9 +1325,9 @@ public override async Task Concat_operator(bool async) """); } - public override async Task Concat_aggregate(bool async) + public override async Task Concat_aggregate() { - await base.Concat_aggregate(async); + await base.Concat_aggregate(); AssertSql( """ @@ -1339,9 +1337,9 @@ GROUP BY b."Int" """); } - public override async Task Concat_string_int_comparison1(bool async) + public override async Task Concat_string_int_comparison1() { - await base.Concat_string_int_comparison1(async); + await base.Concat_string_int_comparison1(); AssertSql( """ @@ -1353,9 +1351,9 @@ public override async Task Concat_string_int_comparison1(bool async) """); } - public override async Task Concat_string_int_comparison2(bool async) + public override async Task Concat_string_int_comparison2() { - await base.Concat_string_int_comparison2(async); + await base.Concat_string_int_comparison2(); AssertSql( """ @@ -1367,9 +1365,9 @@ public override async Task Concat_string_int_comparison2(bool async) """); } - public override async Task Concat_string_int_comparison3(bool async) + public override async Task Concat_string_int_comparison3() { - await base.Concat_string_int_comparison3(async); + await base.Concat_string_int_comparison3(); AssertSql( """ @@ -1382,9 +1380,9 @@ public override async Task Concat_string_int_comparison3(bool async) """); } - public override async Task Concat_string_int_comparison4(bool async) + public override async Task Concat_string_int_comparison4() { - await base.Concat_string_int_comparison4(async); + await base.Concat_string_int_comparison4(); AssertSql( """ @@ -1394,9 +1392,9 @@ public override async Task Concat_string_int_comparison4(bool async) """); } - public override async Task Concat_string_string_comparison(bool async) + public override async Task Concat_string_string_comparison() { - await base.Concat_string_string_comparison(async); + await base.Concat_string_string_comparison(); AssertSql( """ @@ -1408,9 +1406,9 @@ public override async Task Concat_string_string_comparison(bool async) """); } - public override async Task Concat_method_comparison(bool async) + public override async Task Concat_method_comparison() { - await base.Concat_method_comparison(async); + await base.Concat_method_comparison(); AssertSql( """ @@ -1422,9 +1420,9 @@ public override async Task Concat_method_comparison(bool async) """); } - public override async Task Concat_method_comparison_2(bool async) + public override async Task Concat_method_comparison_2() { - await base.Concat_method_comparison_2(async); + await base.Concat_method_comparison_2(); AssertSql( """ @@ -1437,9 +1435,9 @@ public override async Task Concat_method_comparison_2(bool async) """); } - public override async Task Concat_method_comparison_3(bool async) + public override async Task Concat_method_comparison_3() { - await base.Concat_method_comparison_3(async); + await base.Concat_method_comparison_3(); AssertSql( """ @@ -1457,9 +1455,9 @@ public override async Task Concat_method_comparison_3(bool async) #region LINQ Operators - public override async Task FirstOrDefault(bool async) + public override async Task FirstOrDefault() { - await base.FirstOrDefault(async); + await base.FirstOrDefault(); AssertSql( """ SELECT b."Id", b."Bool", b."Byte", b."ByteArray", b."DateOnly", b."DateTime", b."DateTimeOffset", b."Decimal", b."Double", b."Enum", b."FlagsEnum", b."Float", b."Guid", b."Int", b."Long", b."Short", b."String", b."TimeOnly", b."TimeSpan" @@ -1468,9 +1466,9 @@ WHERE substr(b."String", 1, 1) = 'S' """); } - public override async Task LastOrDefault(bool async) + public override async Task LastOrDefault() { - await base.LastOrDefault(async); + await base.LastOrDefault(); AssertSql( """ SELECT b."Id", b."Bool", b."Byte", b."ByteArray", b."DateOnly", b."DateTime", b."DateTimeOffset", b."Decimal", b."Double", b."Enum", b."FlagsEnum", b."Float", b."Guid", b."Int", b."Long", b."Short", b."String", b."TimeOnly", b."TimeSpan" @@ -1483,9 +1481,9 @@ WHERE substr(b."String", length(b."String"), 1) = 'e' #region Like - public override async Task Where_Like_and_comparison(bool async) + public override async Task Where_Like_and_comparison() { - await base.Where_Like_and_comparison(async); + await base.Where_Like_and_comparison(); AssertSql( """ @@ -1495,9 +1493,9 @@ public override async Task Where_Like_and_comparison(bool async) """); } - public override async Task Where_Like_or_comparison(bool async) + public override async Task Where_Like_or_comparison() { - await base.Where_Like_or_comparison(async); + await base.Where_Like_or_comparison(); AssertSql( """ @@ -1507,9 +1505,9 @@ public override async Task Where_Like_or_comparison(bool async) """); } - public override async Task Like_with_non_string_column_using_ToString(bool async) + public override async Task Like_with_non_string_column_using_ToString() { - await base.Like_with_non_string_column_using_ToString(async); + await base.Like_with_non_string_column_using_ToString(); AssertSql( """ @@ -1519,9 +1517,9 @@ public override async Task Like_with_non_string_column_using_ToString(bool async """); } - public override async Task Like_with_non_string_column_using_double_cast(bool async) + public override async Task Like_with_non_string_column_using_double_cast() { - await base.Like_with_non_string_column_using_double_cast(async); + await base.Like_with_non_string_column_using_double_cast(); AssertSql( """ @@ -1535,9 +1533,9 @@ public override async Task Like_with_non_string_column_using_double_cast(bool as #region Regex - public override async Task Regex_IsMatch(bool async) + public override async Task Regex_IsMatch() { - await base.Regex_IsMatch(async); + await base.Regex_IsMatch(); AssertSql( """ @@ -1547,9 +1545,9 @@ public override async Task Regex_IsMatch(bool async) """); } - public override async Task Regex_IsMatch_constant_input(bool async) + public override async Task Regex_IsMatch_constant_input() { - await base.Regex_IsMatch_constant_input(async); + await base.Regex_IsMatch_constant_input(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.cs index 3755823e8a..c89e1ec6e4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public DateOnlyTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITes Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Year(bool async) + public override async Task Year() { - await base.Year(async); + await base.Year(); AssertSql( """ @@ -21,9 +21,9 @@ WHERE date_part('year', b."DateOnly")::int = 1990 """); } - public override async Task Month(bool async) + public override async Task Month() { - await base.Month(async); + await base.Month(); AssertSql( """ @@ -33,9 +33,9 @@ WHERE date_part('month', b."DateOnly")::int = 11 """); } - public override async Task Day(bool async) + public override async Task Day() { - await base.Day(async); + await base.Day(); AssertSql( """ @@ -45,9 +45,9 @@ WHERE date_part('day', b."DateOnly")::int = 10 """); } - public override async Task DayOfYear(bool async) + public override async Task DayOfYear() { - await base.DayOfYear(async); + await base.DayOfYear(); AssertSql( """ @@ -57,9 +57,9 @@ WHERE date_part('doy', b."DateOnly")::int = 314 """); } - public override async Task DayOfWeek(bool async) + public override async Task DayOfWeek() { - await base.DayOfWeek(async); + await base.DayOfWeek(); AssertSql( """ @@ -69,9 +69,9 @@ WHERE floor(date_part('dow', b."DateOnly"))::int = 6 """); } - public override async Task DayNumber(bool async) + public override async Task DayNumber() { - await base.DayNumber(async); + await base.DayNumber(); AssertSql( """ @@ -81,9 +81,9 @@ public override async Task DayNumber(bool async) """); } - public override async Task AddYears(bool async) + public override async Task AddYears() { - await base.AddYears(async); + await base.AddYears(); AssertSql( """ @@ -93,9 +93,9 @@ WHERE CAST(b."DateOnly" + INTERVAL '3 years' AS date) = DATE '1993-11-10' """); } - public override async Task AddMonths(bool async) + public override async Task AddMonths() { - await base.AddMonths(async); + await base.AddMonths(); AssertSql( """ @@ -105,9 +105,9 @@ WHERE CAST(b."DateOnly" + INTERVAL '3 months' AS date) = DATE '1991-02-10' """); } - public override async Task AddDays(bool async) + public override async Task AddDays() { - await base.AddDays(async); + await base.AddDays(); AssertSql( """ @@ -117,9 +117,9 @@ public override async Task AddDays(bool async) """); } - public override async Task DayNumber_subtraction(bool async) + public override async Task DayNumber_subtraction() { - await base.DayNumber_subtraction(async); + await base.DayNumber_subtraction(); AssertSql( """ @@ -131,9 +131,9 @@ public override async Task DayNumber_subtraction(bool async) """); } - public override async Task FromDateTime(bool async) + public override async Task FromDateTime() { - await base.FromDateTime(async); + await base.FromDateTime(); AssertSql( """ @@ -143,9 +143,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS date) = DATE '1998-05-04' """); } - public override async Task FromDateTime_compared_to_property(bool async) + public override async Task FromDateTime_compared_to_property() { - await base.FromDateTime_compared_to_property(async); + await base.FromDateTime_compared_to_property(); AssertSql( """ @@ -155,9 +155,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS date) = b."DateOnly" """); } - public override async Task FromDateTime_compared_to_constant_and_parameter(bool async) + public override async Task FromDateTime_compared_to_constant_and_parameter() { - await base.FromDateTime_compared_to_constant_and_parameter(async); + await base.FromDateTime_compared_to_constant_and_parameter(); AssertSql( """ @@ -169,9 +169,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS date) IN (@dateOnly, DATE '1998-05 """); } - public override async Task ToDateTime_property_with_constant_TimeOnly(bool async) + public override async Task ToDateTime_property_with_constant_TimeOnly() { - await base.ToDateTime_property_with_constant_TimeOnly(async); + await base.ToDateTime_property_with_constant_TimeOnly(); AssertSql( """ @@ -181,9 +181,9 @@ public override async Task ToDateTime_property_with_constant_TimeOnly(bool async """); } - public override async Task ToDateTime_property_with_property_TimeOnly(bool async) + public override async Task ToDateTime_property_with_property_TimeOnly() { - await base.ToDateTime_property_with_property_TimeOnly(async); + await base.ToDateTime_property_with_property_TimeOnly(); AssertSql( """ @@ -193,9 +193,9 @@ public override async Task ToDateTime_property_with_property_TimeOnly(bool async """); } - public override async Task ToDateTime_constant_DateTime_with_property_TimeOnly(bool async) + public override async Task ToDateTime_constant_DateTime_with_property_TimeOnly() { - await base.ToDateTime_constant_DateTime_with_property_TimeOnly(async); + await base.ToDateTime_constant_DateTime_with_property_TimeOnly(); AssertSql( """ @@ -205,9 +205,9 @@ public override async Task ToDateTime_constant_DateTime_with_property_TimeOnly(b """); } - public override async Task ToDateTime_with_complex_DateTime(bool async) + public override async Task ToDateTime_with_complex_DateTime() { - await base.ToDateTime_with_complex_DateTime(async); + await base.ToDateTime_with_complex_DateTime(); AssertSql( """ @@ -217,9 +217,9 @@ WHERE CAST(b."DateOnly" + INTERVAL '1 years' AS date) + b."TimeOnly" = TIMESTAMP """); } - public override async Task ToDateTime_with_complex_TimeOnly(bool async) + public override async Task ToDateTime_with_complex_TimeOnly() { - await base.ToDateTime_with_complex_TimeOnly(async); + await base.ToDateTime_with_complex_TimeOnly(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsNpgsqlTest.cs index 94dd8929cc..48a27eeb58 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsNpgsqlTest.cs @@ -12,12 +12,12 @@ public DateTimeOffsetTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture } // Not supported by design (DateTimeOffset with non-zero offset) - public override Task Now(bool async) - => Assert.ThrowsAsync(() => base.Now(async)); + public override Task Now() + => Assert.ThrowsAsync(() => base.Now()); - public override async Task UtcNow(bool async) + public override async Task UtcNow() { - await base.UtcNow(async); + await base.UtcNow(); AssertSql( """ @@ -29,12 +29,12 @@ public override async Task UtcNow(bool async) // The test compares with new DateTimeOffset().Date, which Npgsql sends as -infinity, causing a discrepancy with the client behavior // which uses 1/1/1:0:0:0 - public override Task Date(bool async) - => Assert.ThrowsAsync(() => base.Date(async)); + public override Task Date() + => Assert.ThrowsAsync(() => base.Date()); - public override async Task Year(bool async) + public override async Task Year() { - await base.Year(async); + await base.Year(); AssertSql( """ @@ -44,9 +44,9 @@ WHERE date_part('year', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 1998 """); } - public override async Task Month(bool async) + public override async Task Month() { - await base.Month(async); + await base.Month(); AssertSql( """ @@ -56,9 +56,9 @@ WHERE date_part('month', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 5 """); } - public override async Task DayOfYear(bool async) + public override async Task DayOfYear() { - await base.DayOfYear(async); + await base.DayOfYear(); AssertSql( """ @@ -68,9 +68,9 @@ WHERE date_part('doy', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 124 """); } - public override async Task Day(bool async) + public override async Task Day() { - await base.Day(async); + await base.Day(); AssertSql( """ @@ -80,9 +80,9 @@ WHERE date_part('day', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 4 """); } - public override async Task Hour(bool async) + public override async Task Hour() { - await base.Hour(async); + await base.Hour(); AssertSql( """ @@ -92,9 +92,9 @@ WHERE date_part('hour', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 15 """); } - public override async Task Minute(bool async) + public override async Task Minute() { - await base.Minute(async); + await base.Minute(); AssertSql( """ @@ -104,9 +104,9 @@ WHERE date_part('minute', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 30 """); } - public override async Task Second(bool async) + public override async Task Second() { - await base.Second(async); + await base.Second(); AssertSql( """ @@ -117,20 +117,20 @@ WHERE date_part('second', b."DateTimeOffset" AT TIME ZONE 'UTC')::int = 10 } // SQL translation not implemented, too annoying - public override Task Millisecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Millisecond() + => AssertTranslationFailed(() => base.Millisecond()); // TODO: #3406 - public override Task Microsecond(bool async) - => AssertTranslationFailed(() => base.Microsecond(async)); + public override Task Microsecond() + => AssertTranslationFailed(() => base.Microsecond()); // TODO: #3406 - public override Task Nanosecond(bool async) - => AssertTranslationFailed(() => base.Nanosecond(async)); + public override Task Nanosecond() + => AssertTranslationFailed(() => base.Nanosecond()); - public override async Task TimeOfDay(bool async) + public override async Task TimeOfDay() { - await base.TimeOfDay(async); + await base.TimeOfDay(); AssertSql( """ @@ -139,9 +139,9 @@ SELECT CAST(b."DateTimeOffset" AT TIME ZONE 'UTC' AS time) """); } - public override async Task AddYears(bool async) + public override async Task AddYears() { - await base.AddYears(async); + await base.AddYears(); AssertSql( """ @@ -150,9 +150,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 years' """); } - public override async Task AddMonths(bool async) + public override async Task AddMonths() { - await base.AddMonths(async); + await base.AddMonths(); AssertSql( """ @@ -161,9 +161,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 months' """); } - public override async Task AddDays(bool async) + public override async Task AddDays() { - await base.AddDays(async); + await base.AddDays(); AssertSql( """ @@ -172,9 +172,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 days' """); } - public override async Task AddHours(bool async) + public override async Task AddHours() { - await base.AddHours(async); + await base.AddHours(); AssertSql( """ @@ -183,9 +183,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 hours' """); } - public override async Task AddMinutes(bool async) + public override async Task AddMinutes() { - await base.AddMinutes(async); + await base.AddMinutes(); AssertSql( """ @@ -194,9 +194,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 mins' """); } - public override async Task AddSeconds(bool async) + public override async Task AddSeconds() { - await base.AddSeconds(async); + await base.AddSeconds(); AssertSql( """ @@ -205,9 +205,9 @@ SELECT b."DateTimeOffset" + INTERVAL '1 secs' """); } - public override async Task AddMilliseconds(bool async) + public override async Task AddMilliseconds() { - await base.AddMilliseconds(async); + await base.AddMilliseconds(); AssertSql( """ @@ -216,15 +216,15 @@ SELECT b."DateTimeOffset" """); } - public override Task ToUnixTimeMilliseconds(bool async) - => AssertTranslationFailed(() => base.ToUnixTimeMilliseconds(async)); + public override Task ToUnixTimeMilliseconds() + => AssertTranslationFailed(() => base.ToUnixTimeMilliseconds()); - public override Task ToUnixTimeSecond(bool async) - => AssertTranslationFailed(() => base.ToUnixTimeSecond(async)); + public override Task ToUnixTimeSecond() + => AssertTranslationFailed(() => base.ToUnixTimeSecond()); - public override async Task Milliseconds_parameter_and_constant(bool async) + public override async Task Milliseconds_parameter_and_constant() { - await base.Milliseconds_parameter_and_constant(async); + await base.Milliseconds_parameter_and_constant(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsNpgsqlTest.cs index ed9e80cd07..0de15d0a4c 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsNpgsqlTest.cs @@ -16,9 +16,9 @@ public DateTimeTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITes Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Now(bool async) + public override async Task Now() { - await base.Now(async); + await base.Now(); AssertSql( """ @@ -30,13 +30,12 @@ WHERE now()::timestamp <> @myDatetime """); } - public override async Task UtcNow(bool async) + public override async Task UtcNow() { // Overriding to set Kind=Utc for timestamptz var myDatetime = DateTime.SpecifyKind(new DateTime(2015, 4, 10), DateTimeKind.Utc); await AssertQuery( - async, ss => ss.Set().Where(c => DateTime.UtcNow != myDatetime)); AssertSql( @@ -51,16 +50,15 @@ WHERE now() <> @myDatetime // DateTime.Today returns a Local DateTime, which can't be compared with timestamptz // (see TemporalTranslationsNpgsqlTimestampWithoutTimeZoneTest for a working version of this test) - public override Task Today(bool async) - => Assert.ThrowsAsync(() => base.Today(async)); + public override Task Today() + => Assert.ThrowsAsync(() => base.Today()); - public override async Task Date(bool async) + public override async Task Date() { // Overriding to set Kind=Utc for timestamptz var myDatetime = DateTime.SpecifyKind(new DateTime(1998, 5, 4), DateTimeKind.Utc); await AssertQuery( - async, ss => ss.Set().Where(o => o.DateTime.Date == myDatetime)); AssertSql( @@ -73,9 +71,9 @@ WHERE date_trunc('day', b."DateTime", 'UTC') = @myDatetime """); } - public override async Task AddYear(bool async) + public override async Task AddYear() { - await base.AddYear(async); + await base.AddYear(); AssertSql( """ @@ -85,9 +83,9 @@ WHERE date_part('year', (b."DateTime" + INTERVAL '1 years') AT TIME ZONE 'UTC'): """); } - public override async Task Year(bool async) + public override async Task Year() { - await base.Year(async); + await base.Year(); AssertSql( """ @@ -97,9 +95,9 @@ WHERE date_part('year', b."DateTime" AT TIME ZONE 'UTC')::int = 1998 """); } - public override async Task Month(bool async) + public override async Task Month() { - await base.Month(async); + await base.Month(); AssertSql( """ @@ -109,9 +107,9 @@ WHERE date_part('month', b."DateTime" AT TIME ZONE 'UTC')::int = 5 """); } - public override async Task DayOfYear(bool async) + public override async Task DayOfYear() { - await base.DayOfYear(async); + await base.DayOfYear(); AssertSql( """ @@ -121,9 +119,9 @@ WHERE date_part('doy', b."DateTime" AT TIME ZONE 'UTC')::int = 124 """); } - public override async Task Day(bool async) + public override async Task Day() { - await base.Day(async); + await base.Day(); AssertSql( """ @@ -133,9 +131,9 @@ WHERE date_part('day', b."DateTime" AT TIME ZONE 'UTC')::int = 4 """); } - public override async Task Hour(bool async) + public override async Task Hour() { - await base.Hour(async); + await base.Hour(); AssertSql( """ @@ -145,9 +143,9 @@ WHERE date_part('hour', b."DateTime" AT TIME ZONE 'UTC')::int = 15 """); } - public override async Task Minute(bool async) + public override async Task Minute() { - await base.Minute(async); + await base.Minute(); AssertSql( """ @@ -157,9 +155,9 @@ WHERE date_part('minute', b."DateTime" AT TIME ZONE 'UTC')::int = 30 """); } - public override async Task Second(bool async) + public override async Task Second() { - await base.Second(async); + await base.Second(); AssertSql( """ @@ -170,12 +168,12 @@ WHERE date_part('second', b."DateTime" AT TIME ZONE 'UTC')::int = 10 } // SQL translation not implemented, too annoying - public override Task Millisecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Millisecond() + => AssertTranslationFailed(() => base.Millisecond()); - public override async Task TimeOfDay(bool async) + public override async Task TimeOfDay() { - await base.TimeOfDay(async); + await base.TimeOfDay(); AssertSql( """ @@ -185,13 +183,12 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS time) = TIME '00:00:00' """); } - public override async Task subtract_and_TotalDays(bool async) + public override async Task subtract_and_TotalDays() { // Overriding to set Kind=Utc for timestamptz var date = DateTime.SpecifyKind(new DateTime(1997, 1, 1), DateTimeKind.Utc); await AssertQuery( - async, ss => ss.Set().Where(o => (o.DateTime - date).TotalDays > 365)); AssertSql( @@ -206,19 +203,18 @@ WHERE date_part('epoch', b."DateTime" - @date) / 86400.0 > 365.0 // DateTime.Parse() returns either a Local or Unspecified DateTime, which can't be compared with timestamptz // (see TemporalTranslationsNpgsqlTimestampWithoutTimeZoneTest for a working version of this test) - public override Task Parse_with_constant(bool async) - => Assert.ThrowsAsync(() => base.Parse_with_constant(async)); + public override Task Parse_with_constant() + => Assert.ThrowsAsync(() => base.Parse_with_constant()); // DateTime.Parse() returns either a Local or Unspecified DateTime, which can't be compared with timestamptz // (see TemporalTranslationsNpgsqlTimestampWithoutTimeZoneTest for a working version of this test) - public override Task Parse_with_parameter(bool async) - => Assert.ThrowsAsync(() => base.Parse_with_parameter(async)); + public override Task Parse_with_parameter() + => Assert.ThrowsAsync(() => base.Parse_with_parameter()); - public override async Task New_with_constant(bool async) + public override async Task New_with_constant() { // Overriding to set Kind=Utc for timestamptz await AssertQuery( - async, ss => ss.Set().Where(o => o.DateTime == new DateTime(1998, 5, 4, 15, 30, 10, DateTimeKind.Utc))); AssertSql( @@ -229,7 +225,7 @@ await AssertQuery( """); } - public override async Task New_with_parameters(bool async) + public override async Task New_with_parameters() { // Overriding to set Kind=Utc for timestamptz var year = 1998; @@ -238,7 +234,6 @@ public override async Task New_with_parameters(bool async) var hour = 15; await AssertQuery( - async, ss => ss.Set().Where(o => o.DateTime == new DateTime(year, month, date, hour, 30, 10, DateTimeKind.Utc))); AssertSql( diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsWithoutTimeZoneTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsWithoutTimeZoneTest.cs index b7cc008bd3..c01b2c5cfb 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsWithoutTimeZoneTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsWithoutTimeZoneTest.cs @@ -19,9 +19,9 @@ public DateTimeTranslationsWithoutTimeZoneTest( Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Now(bool async) + public override async Task Now() { - await base.Now(async); + await base.Now(); AssertSql( """ @@ -33,13 +33,12 @@ WHERE now()::timestamp <> @myDatetime """); } - public override async Task UtcNow(bool async) + public override async Task UtcNow() { // Overriding to set Kind=Utc for timestamptz. This test generally doesn't make much sense here. var myDatetime = DateTime.SpecifyKind(new DateTime(2015, 4, 10), DateTimeKind.Utc); await AssertQuery( - async, ss => ss.Set().Where(c => DateTime.UtcNow != myDatetime)); AssertSql( @@ -52,9 +51,9 @@ WHERE now() <> @myDatetime """); } - public override async Task Today(bool async) + public override async Task Today() { - await base.Today(async); + await base.Today(); AssertSql( """ @@ -64,9 +63,9 @@ public override async Task Today(bool async) """); } - public override async Task Date(bool async) + public override async Task Date() { - await base.Date(async); + await base.Date(); AssertSql( """ @@ -78,9 +77,9 @@ WHERE date_trunc('day', b."DateTime") = @myDatetime """); } - public override async Task AddYear(bool async) + public override async Task AddYear() { - await base.AddYear(async); + await base.AddYear(); AssertSql( """ @@ -90,9 +89,9 @@ WHERE date_part('year', b."DateTime" + INTERVAL '1 years')::int = 1999 """); } - public override async Task Year(bool async) + public override async Task Year() { - await base.Year(async); + await base.Year(); AssertSql( """ @@ -102,9 +101,9 @@ WHERE date_part('year', b."DateTime")::int = 1998 """); } - public override async Task Month(bool async) + public override async Task Month() { - await base.Month(async); + await base.Month(); AssertSql( """ @@ -114,9 +113,9 @@ WHERE date_part('month', b."DateTime")::int = 5 """); } - public override async Task DayOfYear(bool async) + public override async Task DayOfYear() { - await base.DayOfYear(async); + await base.DayOfYear(); AssertSql( """ @@ -126,9 +125,9 @@ WHERE date_part('doy', b."DateTime")::int = 124 """); } - public override async Task Day(bool async) + public override async Task Day() { - await base.Day(async); + await base.Day(); AssertSql( """ @@ -138,9 +137,9 @@ WHERE date_part('day', b."DateTime")::int = 4 """); } - public override async Task Hour(bool async) + public override async Task Hour() { - await base.Hour(async); + await base.Hour(); AssertSql( """ @@ -150,9 +149,9 @@ WHERE date_part('hour', b."DateTime")::int = 15 """); } - public override async Task Minute(bool async) + public override async Task Minute() { - await base.Minute(async); + await base.Minute(); AssertSql( """ @@ -162,9 +161,9 @@ WHERE date_part('minute', b."DateTime")::int = 30 """); } - public override async Task Second(bool async) + public override async Task Second() { - await base.Second(async); + await base.Second(); AssertSql( """ @@ -175,12 +174,12 @@ WHERE date_part('second', b."DateTime")::int = 10 } // SQL translation not implemented, too annoying - public override Task Millisecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Millisecond() + => AssertTranslationFailed(() => base.Millisecond()); - public override async Task TimeOfDay(bool async) + public override async Task TimeOfDay() { - await base.TimeOfDay(async); + await base.TimeOfDay(); AssertSql( """ @@ -190,9 +189,9 @@ public override async Task TimeOfDay(bool async) """); } - public override async Task subtract_and_TotalDays(bool async) + public override async Task subtract_and_TotalDays() { - await base.subtract_and_TotalDays(async); + await base.subtract_and_TotalDays(); AssertSql( """ @@ -204,9 +203,9 @@ WHERE date_part('epoch', b."DateTime" - @date) / 86400.0 > 365.0 """); } - public override async Task Parse_with_constant(bool async) + public override async Task Parse_with_constant() { - await base.Parse_with_constant(async); + await base.Parse_with_constant(); AssertSql( """ @@ -216,9 +215,9 @@ public override async Task Parse_with_constant(bool async) """); } - public override async Task Parse_with_parameter(bool async) + public override async Task Parse_with_parameter() { - await base.Parse_with_parameter(async); + await base.Parse_with_parameter(); AssertSql( """ @@ -230,9 +229,9 @@ public override async Task Parse_with_parameter(bool async) """); } - public override async Task New_with_constant(bool async) + public override async Task New_with_constant() { - await base.New_with_constant(async); + await base.New_with_constant(); AssertSql( """ @@ -242,9 +241,9 @@ public override async Task New_with_constant(bool async) """); } - public override async Task New_with_parameters(bool async) + public override async Task New_with_parameters() { - await base.New_with_parameters(async); + await base.New_with_parameters(); AssertSql( """ diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsNpgsqlTest.cs index d159e5b7e5..5f03e4f5f0 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsNpgsqlTest.cs @@ -11,9 +11,9 @@ public TimeOnlyTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITes Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Hour(bool async) + public override async Task Hour() { - await base.Hour(async); + await base.Hour(); AssertSql( """ @@ -23,9 +23,9 @@ WHERE date_part('hour', b."TimeOnly")::int = 15 """); } - public override async Task Minute(bool async) + public override async Task Minute() { - await base.Minute(async); + await base.Minute(); AssertSql( """ @@ -35,9 +35,9 @@ WHERE date_part('minute', b."TimeOnly")::int = 30 """); } - public override async Task Second(bool async) + public override async Task Second() { - await base.Second(async); + await base.Second(); AssertSql( """ @@ -48,20 +48,20 @@ WHERE date_part('second', b."TimeOnly")::int = 10 } // Translation not yet implemented - public override Task Millisecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Millisecond() + => AssertTranslationFailed(() => base.Millisecond()); // Translation not yet implemented - public override Task Microsecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Microsecond() + => AssertTranslationFailed(() => base.Millisecond()); // Probably not relevant for PostgreSQL, which supports microsecond precision only - public override Task Nanosecond(bool async) - => AssertTranslationFailed(() => base.Millisecond(async)); + public override Task Nanosecond() + => AssertTranslationFailed(() => base.Millisecond()); - public override async Task AddHours(bool async) + public override async Task AddHours() { - await base.AddHours(async); + await base.AddHours(); AssertSql( """ @@ -71,9 +71,9 @@ public override async Task AddHours(bool async) """); } - public override async Task AddMinutes(bool async) + public override async Task AddMinutes() { - await base.AddMinutes(async); + await base.AddMinutes(); AssertSql( """ @@ -83,9 +83,9 @@ public override async Task AddMinutes(bool async) """); } - public override async Task Add_TimeSpan(bool async) + public override async Task Add_TimeSpan() { - await base.Add_TimeSpan(async); + await base.Add_TimeSpan(); AssertSql( """ @@ -95,9 +95,9 @@ public override async Task Add_TimeSpan(bool async) """); } - public override async Task IsBetween(bool async) + public override async Task IsBetween() { - await base.IsBetween(async); + await base.IsBetween(); AssertSql( """ @@ -107,9 +107,9 @@ public override async Task IsBetween(bool async) """); } - public override async Task Subtract(bool async) + public override async Task Subtract() { - await base.Subtract(async); + await base.Subtract(); AssertSql( """ @@ -119,9 +119,9 @@ public override async Task Subtract(bool async) """); } - public override async Task FromDateTime_compared_to_property(bool async) + public override async Task FromDateTime_compared_to_property() { - await base.FromDateTime_compared_to_property(async); + await base.FromDateTime_compared_to_property(); AssertSql( """ @@ -131,9 +131,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS time without time zone) = b."TimeO """); } - public override async Task FromDateTime_compared_to_parameter(bool async) + public override async Task FromDateTime_compared_to_parameter() { - await base.FromDateTime_compared_to_parameter(async); + await base.FromDateTime_compared_to_parameter(); AssertSql( """ @@ -145,9 +145,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS time without time zone) = @time """); } - public override async Task FromDateTime_compared_to_constant(bool async) + public override async Task FromDateTime_compared_to_constant() { - await base.FromDateTime_compared_to_constant(async); + await base.FromDateTime_compared_to_constant(); AssertSql( """ @@ -157,9 +157,9 @@ WHERE CAST(b."DateTime" AT TIME ZONE 'UTC' AS time without time zone) = TIME '15 """); } - public override async Task FromTimeSpan_compared_to_property(bool async) + public override async Task FromTimeSpan_compared_to_property() { - await base.FromTimeSpan_compared_to_property(async); + await base.FromTimeSpan_compared_to_property(); AssertSql( """ @@ -169,9 +169,9 @@ public override async Task FromTimeSpan_compared_to_property(bool async) """); } - public override async Task FromTimeSpan_compared_to_parameter(bool async) + public override async Task FromTimeSpan_compared_to_parameter() { - await base.FromTimeSpan_compared_to_parameter(async); + await base.FromTimeSpan_compared_to_parameter(); AssertSql( """ @@ -183,11 +183,10 @@ public override async Task FromTimeSpan_compared_to_parameter(bool async) """); } - public override async Task Order_by_FromTimeSpan(bool async) + public override async Task Order_by_FromTimeSpan() { // TODO: Base implementation is non-deterministic, remove this override once that's fixed on the EF side. await AssertQuery( - async, ss => ss.Set().OrderBy(x => TimeOnly.FromTimeSpan(x.TimeSpan)).ThenBy(x => x.Id), assertOrder: true); diff --git a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsNpgsqlTest.cs index fbf2cb78e9..c32ecd9369 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsNpgsqlTest.cs @@ -9,9 +9,9 @@ public TimeSpanTranslationsNpgsqlTest(BasicTypesQueryNpgsqlFixture fixture, ITes Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - public override async Task Hours(bool async) + public override async Task Hours() { - await base.Hours(async); + await base.Hours(); AssertSql( """ @@ -21,9 +21,9 @@ WHERE floor(date_part('hour', b."TimeSpan"))::int = 3 """); } - public override async Task Minutes(bool async) + public override async Task Minutes() { - await base.Minutes(async); + await base.Minutes(); AssertSql( """ @@ -33,9 +33,9 @@ WHERE floor(date_part('minute', b."TimeSpan"))::int = 4 """); } - public override async Task Seconds(bool async) + public override async Task Seconds() { - await base.Seconds(async); + await base.Seconds(); AssertSql( """ @@ -45,9 +45,9 @@ WHERE floor(date_part('second', b."TimeSpan"))::int = 5 """); } - public override async Task Milliseconds(bool async) + public override async Task Milliseconds() { - await base.Milliseconds(async); + await base.Milliseconds(); AssertSql( """ @@ -57,11 +57,11 @@ WHERE floor(date_part('millisecond', b."TimeSpan"))::int % 1000 = 678 """); } - public override Task Microseconds(bool async) - => AssertTranslationFailed(() => base.Microseconds(async)); + public override Task Microseconds() + => AssertTranslationFailed(() => base.Microseconds()); - public override Task Nanoseconds(bool async) - => AssertTranslationFailed(() => base.Nanoseconds(async)); + public override Task Nanoseconds() + => AssertTranslationFailed(() => base.Nanoseconds()); [ConditionalFact] public virtual void Check_all_tests_overridden() diff --git a/test/EFCore.PG.FunctionalTests/Update/ComplexCollectionJsonUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Update/ComplexCollectionJsonUpdateNpgsqlTest.cs new file mode 100644 index 0000000000..825622b1a8 --- /dev/null +++ b/test/EFCore.PG.FunctionalTests/Update/ComplexCollectionJsonUpdateNpgsqlTest.cs @@ -0,0 +1,276 @@ +namespace Microsoft.EntityFrameworkCore.Update; + +public class ComplexCollectionJsonUpdateNpgsqlTest : ComplexCollectionJsonUpdateTestBase< + ComplexCollectionJsonUpdateNpgsqlTest.ComplexCollectionJsonUpdateNpgsqlFixture> +{ + public ComplexCollectionJsonUpdateNpgsqlTest(ComplexCollectionJsonUpdateNpgsqlFixture fixture) + : base(fixture) + => ClearLog(); + + public override async Task Add_element_to_complex_collection_mapped_to_json() + { + await base.Add_element_to_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"First Contact","PhoneNumbers":["555-1234","555-5678"]},{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]},{"Name":"New Contact","PhoneNumbers":["555-0000"]}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Remove_element_from_complex_collection_mapped_to_json() + { + await base.Remove_element_from_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Modify_element_in_complex_collection_mapped_to_json() + { + await base.Modify_element_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"First Contact - Modified","PhoneNumbers":["555-1234","555-5678"]},{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Move_elements_in_complex_collection_mapped_to_json() + { + await base.Move_elements_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]},{"Name":"First Contact","PhoneNumbers":["555-1234","555-5678"]}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Change_complex_collection_mapped_to_json_to_null_and_to_empty() + { + await base.Change_complex_collection_mapped_to_json_to_null_and_to_empty(); + + AssertSql( + """ +@p0='[]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +""", + // + """ +@p0=NULL (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Complex_collection_with_nested_complex_type_mapped_to_json() + { + await base.Complex_collection_with_nested_complex_type_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"John Doe","PhoneNumbers":["555-1234","555-5678"],"Address":{"City":"Seattle","Country":"USA","PostalCode":"98101","Street":"123 Main St"}},{"Name":"Jane Smith","PhoneNumbers":["555-9876"],"Address":{"City":"Portland","Country":"USA","PostalCode":"97201","Street":"456 Oak Ave"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Modify_multiple_complex_properties_mapped_to_json() + { + await base.Modify_multiple_complex_properties_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Contact 1","PhoneNumbers":["555-1111"]}]' (Nullable = false) (DbType = Object) +@p1='{"Budget":50000.00,"Name":"Department A"}' (Nullable = false) (DbType = Object) +@p2='1' + +UPDATE "Companies" SET "Contacts" = @p0, "Department" = @p1 +WHERE "Id" = @p2; +"""); + } + + public override async Task Clear_complex_collection_mapped_to_json() + { + await base.Clear_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Replace_entire_complex_collection_mapped_to_json() + { + await base.Replace_entire_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Replacement Contact 1","PhoneNumbers":["999-1111"]},{"Name":"Replacement Contact 2","PhoneNumbers":["999-2222","999-3333"]}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Contacts" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Add_element_to_nested_complex_collection_mapped_to_json() + { + await base.Add_element_to_nested_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001","555-9999"],"Address":{"City":"Initial City","Country":"USA","PostalCode":"00001","Street":"100 First St"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Modify_nested_complex_property_in_complex_collection_mapped_to_json() + { + await base.Modify_nested_complex_property_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001"],"Address":{"City":"Modified City","Country":"USA","PostalCode":"99999","Street":"100 First St"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Set_complex_collection_to_null_mapped_to_json() + { + await base.Set_complex_collection_to_null_mapped_to_json(); + + AssertSql( + """ +@p0=NULL (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Set_null_complex_collection_to_non_empty_mapped_to_json() + { + await base.Set_null_complex_collection_to_non_empty_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"New Employee","PhoneNumbers":["555-1111"],"Address":{"City":"New City","Country":"USA","PostalCode":"12345","Street":"123 New St"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Replace_complex_collection_element_mapped_to_json() + { + await base.Replace_complex_collection_element_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Replacement Employee","PhoneNumbers":["555-7777","555-8888"],"Address":{"City":"Replace City","Country":"Canada","PostalCode":"54321","Street":"789 Replace St"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Complex_collection_with_empty_nested_collections_mapped_to_json() + { + await base.Complex_collection_with_empty_nested_collections_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001"],"Address":{"City":"Initial City","Country":"USA","PostalCode":"00001","Street":"100 First St"}},{"Name":"Employee No Phone","PhoneNumbers":[],"Address":{"City":"Quiet City","Country":"USA","PostalCode":"00000","Street":"456 No Phone St"}}]' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Employees" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Set_complex_property_mapped_to_json_to_null() + { + await base.Set_complex_property_mapped_to_json_to_null(); + + AssertSql( + """ +@p0=NULL (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Department" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Set_null_complex_property_to_non_null_mapped_to_json() + { + await base.Set_null_complex_property_to_non_null_mapped_to_json(); + + AssertSql( + """ +@p0='{"Budget":25000.00,"Name":"New Department"}' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Department" = @p0 +WHERE "Id" = @p1; +"""); + } + + public override async Task Replace_complex_property_mapped_to_json() + { + await base.Replace_complex_property_mapped_to_json(); + + AssertSql( + """ +@p0='{"Budget":99999.99,"Name":"Replacement Department"}' (Nullable = false) (DbType = Object) +@p1='1' + +UPDATE "Companies" SET "Department" = @p0 +WHERE "Id" = @p1; +"""); + } + + public class ComplexCollectionJsonUpdateNpgsqlFixture : ComplexCollectionJsonUpdateFixtureBase + { + protected override ITestStoreFactory TestStoreFactory + => NpgsqlTestStoreFactory.Instance; + } +}