diff --git a/Directory.Packages.props b/Directory.Packages.props index ae8c8adaa..a698e8a4a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,7 +1,7 @@ - 10.0.0-rc.2.25468.104 - 10.0.0-rc.2.25468.104 + 10.0.0-rc.2.25502.106 + 10.0.0-rc.2.25502.106 9.0.3 diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs index 5112f1f79..baba29db4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateNpgsqlTest.cs @@ -20,16 +20,16 @@ DELETE FROM "RootEntity" AS r """); } - public override async Task Delete_required_association() + public override async Task Delete_required_associate() { - await base.Delete_required_association(); + await base.Delete_required_associate(); AssertSql(); } - public override async Task Delete_optional_association() + public override async Task Delete_optional_associate() { - await base.Delete_optional_association(); + await base.Delete_optional_associate(); AssertSql(); } @@ -38,60 +38,67 @@ public override async Task Delete_optional_association() #region Update properties - public override async Task Update_property_inside_association() + public override async Task Update_property_inside_associate() { - await base.Update_property_inside_association(); + await base.Update_property_inside_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', to_jsonb(@p)) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb(@p)) """); } - public override async Task Update_property_inside_association_with_special_chars() + public override async Task Update_property_inside_associate_with_special_chars() { - await base.Update_property_inside_association_with_special_chars(); + await base.Update_property_inside_associate_with_special_chars(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', to_jsonb('{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }'::text)) -WHERE (r."RequiredRelated" ->> 'String') = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb('{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }'::text)) +WHERE (r."RequiredAssociate" ->> 'String') = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' """); } - public override async Task Update_property_inside_nested() + public override async Task Update_property_inside_nested_associate() { - await base.Update_property_inside_nested(); + await base.Update_property_inside_nested_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{RequiredNested,String}', to_jsonb(@p)) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{RequiredNestedAssociate,String}', to_jsonb(@p)) """); } - public override async Task Update_property_on_projected_association() + public override async Task Update_property_on_projected_associate() { - await base.Update_property_on_projected_association(); + await base.Update_property_on_projected_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', to_jsonb(@p)) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', to_jsonb(@p)) """); } - public override async Task Update_property_on_projected_association_with_OrderBy_Skip() + public override async Task Update_property_on_projected_associate_with_OrderBy_Skip() { - await base.Update_property_on_projected_association_with_OrderBy_Skip(); + await base.Update_property_on_projected_associate_with_OrderBy_Skip(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_associate_with_null_required_property() + { + await base.Update_associate_with_null_required_property(); AssertExecuteUpdateSql(); } @@ -100,122 +107,129 @@ public override async Task Update_property_on_projected_association_with_OrderBy #region Update association - public override async Task Update_association_to_parameter() + public override async Task Update_associate_to_parameter() { - await base.Update_association_to_parameter(); + await base.Update_associate_to_parameter(); AssertExecuteUpdateSql( """ @complex_type_p='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated" = @complex_type_p +SET "RequiredAssociate" = @complex_type_p """); } - public override async Task Update_nested_association_to_parameter() + public override async Task Update_nested_associate_to_parameter() { - await base.Update_nested_association_to_parameter(); + await base.Update_nested_associate_to_parameter(); AssertExecuteUpdateSql( """ @complex_type_p='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{RequiredNested}', @complex_type_p) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{RequiredNestedAssociate}', @complex_type_p) """); } - public override async Task Update_association_to_another_association() + public override async Task Update_associate_to_another_associate() { - await base.Update_association_to_another_association(); + await base.Update_associate_to_another_associate(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated" = r."RequiredRelated" +SET "OptionalAssociate" = r."RequiredAssociate" """); } - public override async Task Update_nested_association_to_another_nested_association() + public override async Task Update_nested_associate_to_another_nested_associate() { - await base.Update_nested_association_to_another_nested_association(); + await base.Update_nested_associate_to_another_nested_associate(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{OptionalNested}', r."RequiredRelated" -> 'RequiredNested') +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{OptionalNestedAssociate}', r."RequiredAssociate" -> 'RequiredNestedAssociate') """); } - public override async Task Update_association_to_inline() + public override async Task Update_associate_to_inline() { - await base.Update_association_to_inline(); + await base.Update_associate_to_inline(); AssertExecuteUpdateSql( """ @complex_type_p='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated" = @complex_type_p +SET "RequiredAssociate" = @complex_type_p """); } - public override async Task Update_association_to_inline_with_lambda() + public override async Task Update_associate_to_inline_with_lambda() { - await base.Update_association_to_inline_with_lambda(); + await base.Update_associate_to_inline_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = '{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated related name","String":"Updated related string","NestedCollection":[],"OptionalNested":null,"RequiredNested":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' +SET "RequiredAssociate" = '{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated associate name","String":"Updated associate string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' """); } - public override async Task Update_nested_association_to_inline_with_lambda() + public override async Task Update_nested_associate_to_inline_with_lambda() { - await base.Update_nested_association_to_inline_with_lambda(); + await base.Update_nested_associate_to_inline_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{RequiredNested}', '{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}') +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{RequiredNestedAssociate}', '{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}') """); } - public override async Task Update_association_to_null() + public override async Task Update_associate_to_null() { - await base.Update_association_to_null(); + await base.Update_associate_to_null(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated" = NULL +SET "OptionalAssociate" = NULL """); } - public override async Task Update_association_to_null_with_lambda() + public override async Task Update_associate_to_null_with_lambda() { - await base.Update_association_to_null_with_lambda(); + await base.Update_associate_to_null_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated" = NULL +SET "OptionalAssociate" = NULL """); } - public override async Task Update_association_to_null_parameter() + public override async Task Update_associate_to_null_parameter() { - await base.Update_association_to_null_parameter(); + await base.Update_associate_to_null_parameter(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated" = NULL +SET "OptionalAssociate" = NULL """); } + public override async Task Update_required_nested_associate_to_null() + { + await base.Update_required_nested_associate_to_null(); + + AssertExecuteUpdateSql(); + } + #endregion Update association #region Update collection @@ -229,7 +243,7 @@ public override async Task Update_collection_to_parameter() @complex_type_p='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RelatedCollection" = @complex_type_p +SET "AssociateCollection" = @complex_type_p """); } @@ -242,7 +256,7 @@ public override async Task Update_nested_collection_to_parameter() @complex_type_p='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{NestedCollection}', @complex_type_p) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{NestedCollection}', @complex_type_p) """); } @@ -253,7 +267,7 @@ public override async Task Update_nested_collection_to_inline_with_lambda() AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{NestedCollection}', '[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]') +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{NestedCollection}', '[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]') """); } @@ -264,8 +278,8 @@ public override async Task Update_nested_collection_to_another_nested_collection AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{NestedCollection}', r."OptionalRelated" -> 'NestedCollection') -WHERE (r."OptionalRelated") IS NOT NULL +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{NestedCollection}', r."OptionalAssociate" -> 'NestedCollection') +WHERE (r."OptionalAssociate") IS NOT NULL """); } @@ -294,7 +308,7 @@ public override async Task Update_primitive_collection_to_constant() AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{Ints}', '[1,2,4]') +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{Ints}', '[1,2,4]') """); } @@ -307,7 +321,7 @@ public override async Task Update_primitive_collection_to_parameter() @ints='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{Ints}', @ints) +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{Ints}', @ints) """); } @@ -318,7 +332,7 @@ public override async Task Update_primitive_collection_to_another_collection() AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{OptionalNested,Ints}', r."RequiredRelated" #> '{RequiredNested,Ints}') +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{OptionalNestedAssociate,Ints}', r."RequiredAssociate" #> '{RequiredNestedAssociate,Ints}') """); } @@ -331,8 +345,8 @@ public override async Task Update_inside_primitive_collection() @p='?' (DbType = Int32) UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{Ints,1}', to_jsonb(@p)) -WHERE jsonb_array_length(r."RequiredRelated" -> 'Ints') >= 2 +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{Ints,1}', to_jsonb(@p)) +WHERE jsonb_array_length(r."RequiredAssociate" -> 'Ints') >= 2 """); } @@ -340,9 +354,9 @@ WHERE jsonb_array_length(r."RequiredRelated" -> 'Ints') >= 2 #region Multiple updates - public override async Task Update_multiple_properties_inside_same_association() + public override async Task Update_multiple_properties_inside_same_associate() { - await base.Update_multiple_properties_inside_same_association(); + await base.Update_multiple_properties_inside_same_associate(); AssertExecuteUpdateSql( """ @@ -350,13 +364,13 @@ public override async Task Update_multiple_properties_inside_same_association() @p0='?' (DbType = Int32) UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(jsonb_set(r."RequiredRelated", '{String}', to_jsonb(@p)), '{Int}', to_jsonb(@p0)) +SET "RequiredAssociate" = jsonb_set(jsonb_set(r."RequiredAssociate", '{String}', to_jsonb(@p)), '{Int}', to_jsonb(@p0)) """); } - public override async Task Update_multiple_properties_inside_associations_and_on_entity_type() + public override async Task Update_multiple_properties_inside_associates_and_on_entity_type() { - await base.Update_multiple_properties_inside_associations_and_on_entity_type(); + await base.Update_multiple_properties_inside_associates_and_on_entity_type(); AssertExecuteUpdateSql( """ @@ -364,24 +378,24 @@ public override async Task Update_multiple_properties_inside_associations_and_on UPDATE "RootEntity" AS r SET "Name" = r."Name" || 'Modified', - "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', r."OptionalRelated" -> 'String'), - "OptionalRelated" = jsonb_set(r."OptionalRelated", '{RequiredNested,String}', to_jsonb(@p)) -WHERE (r."OptionalRelated") IS NOT NULL + "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', r."OptionalAssociate" -> 'String'), + "OptionalAssociate" = jsonb_set(r."OptionalAssociate", '{RequiredNestedAssociate,String}', to_jsonb(@p)) +WHERE (r."OptionalAssociate") IS NOT NULL """); } - public override async Task Update_multiple_projected_associations_via_anonymous_type() + public override async Task Update_multiple_projected_associates_via_anonymous_type() { - await base.Update_multiple_projected_associations_via_anonymous_type(); + await base.Update_multiple_projected_associates_via_anonymous_type(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated" = jsonb_set(r."RequiredRelated", '{String}', r."OptionalRelated" -> 'String'), - "OptionalRelated" = jsonb_set(r."OptionalRelated", '{String}', to_jsonb(@p)) -WHERE (r."OptionalRelated") IS NOT NULL +SET "RequiredAssociate" = jsonb_set(r."RequiredAssociate", '{String}', r."OptionalAssociate" -> 'String'), + "OptionalAssociate" = jsonb_set(r."OptionalAssociate", '{String}', to_jsonb(@p)) +WHERE (r."OptionalAssociate") IS NOT NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs index 44cbbfb17..14204c04b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionNpgsqlTest.cs @@ -9,20 +9,20 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( SELECT count(*)::int - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb - )) WITH ORDINALITY AS r0) = 2 + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a) = 2 """); } @@ -32,12 +32,12 @@ public override async Task Where() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" 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 + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("Int" integer)) WITH ORDINALITY AS a + WHERE a."Int" <> 8) = 2 """); } @@ -47,15 +47,15 @@ public override async Task OrderBy_ElementAt() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( - SELECT r0."Int" - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + SELECT a."Int" + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer - )) WITH ORDINALITY AS r0 - ORDER BY r0."Id" NULLS FIRST + )) WITH ORDINALITY AS a + ORDER BY a."Id" NULLS FIRST LIMIT 1 OFFSET 0) = 8 """); } @@ -68,23 +68,23 @@ public override async Task Distinct() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( SELECT count(*)::int FROM ( - SELECT DISTINCT r0."Id", r0."Int", r0."Ints", 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 ( + SELECT DISTINCT a."Id", a."Int", a."Ints", a."Name", a."String", a."NestedCollection" AS c, a."OptionalNestedAssociate" AS c0, a."RequiredNestedAssociate" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb - )) WITH ORDINALITY AS r0 - ) AS r1) = 2 + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a + ) AS a0) = 2 """); } @@ -101,14 +101,14 @@ public override async Task Distinct_over_projected_nested_collection() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" 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 + SELECT DISTINCT a."NestedCollection" AS c + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS a + ) AS a0) = 2 """); } @@ -129,9 +129,9 @@ public override async Task Index_constant() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> '{0,Int}' AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> '{0,Int}' AS integer)) = 8 """); } @@ -143,9 +143,9 @@ public override async Task Index_parameter() """ @i='?' (DbType = Int32) -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 """); } @@ -155,9 +155,9 @@ public override async Task Index_column() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 """); } @@ -167,9 +167,9 @@ public override async Task Index_out_of_bounds() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> '{9999,Int}' AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> '{9999,Int}' AS integer)) = 8 """); } @@ -184,15 +184,15 @@ public override async Task GroupBy() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE 16 IN ( - SELECT COALESCE(sum(r0."Int"), 0)::int - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + SELECT COALESCE(sum(a."Int"), 0)::int + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Int" integer, "String" text - )) WITH ORDINALITY AS r0 - GROUP BY r0."String" + )) WITH ORDINALITY AS a + GROUP BY a."String" ) """); } @@ -208,8 +208,8 @@ public override async Task Select_within_Select_within_Select_with_aggregates() 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 ROWS FROM (jsonb_to_recordset(a."NestedCollection") AS ("Int" integer)) WITH ORDINALITY AS n)), 0)::int + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS a) FROM "RootEntity" AS r """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs index 7f15a6a34..cda65c84d 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousNpgsqlTest.cs @@ -8,39 +8,39 @@ public class ComplexJsonMiscellaneousNpgsqlTest(ComplexJsonNpgsqlFixture fixture { #region Simple filters - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(r."RequiredAssociate" ->> 'Int' AS integer)) = 8 """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."OptionalRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(r."OptionalAssociate" ->> 'Int' AS integer)) = 8 """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" #>> '{RequiredNested,Int}' AS integer)) = 8 +WHERE (CAST(r."RequiredAssociate" #>> '{RequiredNestedAssociate,Int}' AS integer)) = 8 """); } @@ -54,9 +54,9 @@ public override async Task Where_property_on_non_nullable_value_type() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +SELECT v."Id", v."Name", v."AssociateCollection", v."OptionalAssociate", v."RequiredAssociate" FROM "ValueRootEntity" AS v -WHERE (CAST(v."RequiredRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(v."RequiredAssociate" ->> 'Int' AS integer)) = 8 """); } @@ -66,9 +66,9 @@ public override async Task Where_property_on_nullable_value_type_Value() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +SELECT v."Id", v."Name", v."AssociateCollection", v."OptionalAssociate", v."RequiredAssociate" FROM "ValueRootEntity" AS v -WHERE (CAST(v."OptionalRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(v."OptionalAssociate" ->> 'Int' AS integer)) = 8 """); } @@ -78,9 +78,9 @@ public override async Task Where_HasValue_on_nullable_value_type() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +SELECT v."Id", v."Name", v."AssociateCollection", v."OptionalAssociate", v."RequiredAssociate" FROM "ValueRootEntity" AS v -WHERE (v."OptionalRelated") IS NOT NULL +WHERE (v."OptionalAssociate") IS NOT NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionNpgsqlTest.cs index d44cabd11..afed687c4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionNpgsqlTest.cs @@ -9,9 +9,9 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE jsonb_array_length(r."RequiredRelated" -> 'Ints') = 3 +WHERE jsonb_array_length(r."RequiredAssociate" -> 'Ints') = 3 """); } @@ -21,9 +21,9 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" #>> '{Ints,0}' AS integer)) = 1 +WHERE (CAST(r."RequiredAssociate" #>> '{Ints,0}' AS integer)) = 1 """); } @@ -33,9 +33,9 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'Ints') @> to_jsonb(3) +WHERE (r."RequiredAssociate" -> 'Ints') @> to_jsonb(3) """); } @@ -45,9 +45,9 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'Ints') @> to_jsonb(2) +WHERE (r."RequiredAssociate" -> 'Ints') @> to_jsonb(2) """); } @@ -57,9 +57,9 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE jsonb_array_length(r."RequiredRelated" #> '{RequiredNested,Ints}') = 3 +WHERE jsonb_array_length(r."RequiredAssociate" #> '{RequiredNestedAssociate,Ints}') = 3 """); } @@ -71,11 +71,11 @@ public override async Task Select_Sum() """ SELECT ( SELECT COALESCE(sum(i0.element::int), 0)::int - FROM jsonb_array_elements_text(r."RequiredRelated" -> 'Ints') WITH ORDINALITY AS i0(element)) + FROM jsonb_array_elements_text(r."RequiredAssociate" -> 'Ints') WITH ORDINALITY AS i0(element)) FROM "RootEntity" AS r WHERE ( SELECT COALESCE(sum(i.element::int), 0)::int - FROM jsonb_array_elements_text(r."RequiredRelated" -> 'Ints') WITH ORDINALITY AS i(element)) >= 6 + FROM jsonb_array_elements_text(r."RequiredAssociate" -> 'Ints') WITH ORDINALITY AS i(element)) >= 6 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs index 79d181db9..1004c7a98 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionNpgsqlTest.cs @@ -12,53 +12,53 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r """); } #region Simple properties - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" ->> 'String' +SELECT r."RequiredAssociate" ->> 'String' FROM "RootEntity" AS r """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" ->> 'String' +SELECT r."OptionalAssociate" ->> 'String' FROM "RootEntity" AS r """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ -SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +SELECT CAST(r."OptionalAssociate" ->> 'Int' AS integer) FROM "RootEntity" AS r """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ -SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +SELECT CAST(r."OptionalAssociate" ->> 'Int' AS integer) FROM "RootEntity" AS r """); } @@ -67,154 +67,176 @@ SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) #region Non-collection - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" +SELECT r."RequiredAssociate" FROM "RootEntity" AS r """); } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" +SELECT r."OptionalAssociate" FROM "RootEntity" AS r """); } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" -> 'RequiredNested' +SELECT r."RequiredAssociate" -> 'RequiredNestedAssociate' FROM "RootEntity" AS r """); } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" -> 'OptionalNested' +SELECT r."RequiredAssociate" -> 'OptionalNestedAssociate' FROM "RootEntity" AS r """); } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" -> 'RequiredNested' +SELECT r."OptionalAssociate" -> 'RequiredNestedAssociate' FROM "RootEntity" AS r """); } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" -> 'OptionalNested' +SELECT r."OptionalAssociate" -> 'OptionalNestedAssociate' FROM "RootEntity" AS r """); } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); AssertSql( """ -SELECT r0."RequiredRelated" +SELECT r0."RequiredAssociate" FROM "RootReferencingEntity" AS r LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" """); } + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" +FROM "RootEntity" AS r +"""); + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."RequiredAssociate" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + #endregion Non-collection #region Collection - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); AssertSql( """ -SELECT r."RelatedCollection" +SELECT r."AssociateCollection" FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" -> 'NestedCollection' +SELECT r."RequiredAssociate" -> 'NestedCollection' FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" -> 'NestedCollection' +SELECT r."OptionalAssociate" -> 'NestedCollection' FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); AssertSql( """ -SELECT r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r0."NestedCollection", r0."OptionalNested", r0."RequiredNested" +SELECT a."Id", a."Int", a."Ints", a."Name", a."String", a."NestedCollection", a."OptionalNestedAssociate", a."RequiredNestedAssociate" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb -)) WITH ORDINALITY AS r0 ON TRUE + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb +)) WITH ORDINALITY AS a ON TRUE """); } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); AssertSql( """ SELECT n."Id", n."Int", n."Ints", n."Name", n."String" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -224,15 +246,15 @@ JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollect """); } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); AssertSql( """ SELECT n."Id", n."Int", n."Ints", n."Name", n."String" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalRelated" -> 'NestedCollection') AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -252,7 +274,7 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r """); } @@ -270,7 +292,7 @@ public override async Task Select_subquery_required_related_FirstOrDefault(Query SELECT r1.c FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."RequiredRelated" -> 'RequiredNested' AS c + SELECT r0."RequiredAssociate" -> 'RequiredNestedAssociate' AS c FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -287,7 +309,7 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query SELECT r1.c FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."OptionalRelated" -> 'RequiredNested' AS c + SELECT r0."OptionalAssociate" -> 'RequiredNestedAssociate' AS c FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -305,7 +327,7 @@ public override async Task Select_root_with_value_types(QueryTrackingBehavior qu AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +SELECT v."Id", v."Name", v."AssociateCollection", v."OptionalAssociate", v."RequiredAssociate" FROM "ValueRootEntity" AS v """); } @@ -316,7 +338,7 @@ public override async Task Select_non_nullable_value_type(QueryTrackingBehavior AssertSql( """ -SELECT v."RequiredRelated" +SELECT v."RequiredAssociate" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); @@ -328,7 +350,7 @@ public override async Task Select_nullable_value_type(QueryTrackingBehavior quer AssertSql( """ -SELECT v."OptionalRelated" +SELECT v."OptionalAssociate" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); @@ -340,7 +362,7 @@ public override async Task Select_nullable_value_type_with_Value(QueryTrackingBe AssertSql( """ -SELECT v."OptionalRelated" +SELECT v."OptionalAssociate" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs index 80934d305..916c8ff90 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsNpgsqlTest.cs @@ -6,38 +6,38 @@ namespace Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; public class ComplexJsonSetOperationsNpgsqlTest(ComplexJsonNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) : ComplexJsonSetOperationsRelationalTestBase(fixture, testOutputHelper) { - public override async Task On_related() + public override async Task Over_associate_collections() { - await base.On_related(); + await base.Over_associate_collections(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" 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 + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("Int" integer)) WITH ORDINALITY AS a + WHERE a."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' + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("String" text)) WITH ORDINALITY AS a0 + WHERE a0."String" = 'foo' ) AS u) = 4 """); } - public override async Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) { - await base.On_related_projected(queryTrackingBehavior); + await base.Over_associate_collection_projected(queryTrackingBehavior); AssertSql(); } - public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) { - await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); AssertSql( """ @@ -46,41 +46,41 @@ 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 ( + SELECT a."NestedCollection" AS "NestedCollection" + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Int" integer, "NestedCollection" jsonb - )) WITH ORDINALITY AS r0 - WHERE r0."Int" = 8 + )) WITH ORDINALITY AS a + WHERE a."Int" = 8 UNION ALL - SELECT r1."NestedCollection" AS "NestedCollection" - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + SELECT a0."NestedCollection" AS "NestedCollection" + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "String" text, "NestedCollection" jsonb - )) WITH ORDINALITY AS r1 - WHERE r1."String" = 'foo' + )) WITH ORDINALITY AS a0 + WHERE a0."String" = 'foo' ) AS u) FROM "RootEntity" AS r """); } - public override async Task On_nested() + public override async Task Over_nested_associate_collection() { - await base.On_nested(); + await base.Over_nested_associate_collection(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" 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 + FROM ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> '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 + FROM ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ("String" text)) WITH ORDINALITY AS n0 WHERE n0."String" = 'foo' ) AS u) = 4 """); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs index fc3f43cb3..ea0f4ad95 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityNpgsqlTest.cs @@ -10,27 +10,27 @@ public class ComplexJsonStructuralEqualityNpgsqlTest(ComplexJsonNpgsqlFixture fi // 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() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated") = (r."OptionalRelated") +WHERE (r."RequiredAssociate") = (r."OptionalAssociate") """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'RequiredNested') = (r."OptionalRelated" -> 'RequiredNested') +WHERE (r."RequiredAssociate" -> 'RequiredNestedAssociate') = (r."OptionalAssociate" -> 'RequiredNestedAssociate') """); } @@ -40,71 +40,71 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated") <> (r."OptionalRelated") OR (r."OptionalRelated") IS NULL +WHERE (r."RequiredAssociate") <> (r."OptionalAssociate") OR (r."OptionalAssociate") IS NULL """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."OptionalRelated") IS NULL +WHERE (r."OptionalAssociate") IS NULL """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."OptionalRelated") IS NULL +WHERE (r."OptionalAssociate") IS NULL """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" ->> 'OptionalNested') IS NULL +WHERE (r."RequiredAssociate" ->> 'OptionalNestedAssociate') IS NULL """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'RequiredNested') = '{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredRelated_RequiredNested","String":"foo"}' +WHERE (r."RequiredAssociate" -> 'RequiredNestedAssociate') = '{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_RequiredNestedAssociate","String":"foo"}' """); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_with_parameter(); AssertSql( """ @entity_equality_nested='?' (DbType = Object) -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'RequiredNested') = @entity_equality_nested +WHERE (r."RequiredAssociate" -> 'RequiredNestedAssociate') = @entity_equality_nested """); } @@ -114,9 +114,9 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'NestedCollection') = (r."OptionalRelated" -> 'NestedCollection') +WHERE (r."RequiredAssociate" -> 'NestedCollection') = (r."OptionalAssociate" -> 'NestedCollection') """); } @@ -126,9 +126,9 @@ public override async Task Nested_collection_with_inline() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'NestedCollection') = '[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredRelated_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredRelated_NestedCollection_2","String":"foo"}]' +WHERE (r."RequiredAssociate" -> 'NestedCollection') = '[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_2","String":"foo"}]' """); } @@ -140,9 +140,9 @@ public override async Task Nested_collection_with_parameter() """ @entity_equality_nestedCollection='?' (DbType = Object) -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'NestedCollection') = @entity_equality_nestedCollection +WHERE (r."RequiredAssociate" -> 'NestedCollection') = @entity_equality_nestedCollection """); } @@ -160,18 +160,18 @@ await Assert.ThrowsAsync(async () => // elements down to their columns and doing column-by-column comparison. See #32576. AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE EXISTS ( SELECT 1 - FROM ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( + FROM ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text )) WITH ORDINALITY AS n - WHERE n."Id" = 1002 AND n."Int" = 8 AND n."Ints" = '[1,2,3]' AND n."Name" = 'Root1_RequiredRelated_NestedCollection_1' AND n."String" = 'foo') + WHERE n."Id" = 1002 AND n."Int" = 8 AND n."Ints" = '[1,2,3]' AND n."Name" = 'Root1_RequiredAssociate_NestedCollection_1' AND n."String" = 'foo') """); }); } @@ -194,11 +194,11 @@ await Assert.ThrowsAsync(async () => @entity_equality_nested_Name='?' @entity_equality_nested_String='?' -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE EXISTS ( SELECT 1 - FROM ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( + FROM ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -226,11 +226,11 @@ await Assert.ThrowsAsync(async () => @entity_equality_get_Item_Name='?' @entity_equality_get_Item_String='?' -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE EXISTS ( SELECT 1 - FROM ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( + FROM ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -258,24 +258,24 @@ await Assert.ThrowsAsync(async () => @entity_equality_get_Item_Name='?' @entity_equality_get_Item_String='?' @entity_equality_get_Item_NestedCollection='?' (DbType = Object) -@entity_equality_get_Item_OptionalNested='?' (DbType = Object) -@entity_equality_get_Item_RequiredNested='?' (DbType = Object) +@entity_equality_get_Item_OptionalNestedAssociate='?' (DbType = Object) +@entity_equality_get_Item_RequiredNestedAssociate='?' (DbType = Object) -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE EXISTS ( SELECT 1 - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb - )) WITH ORDINALITY AS r0 - WHERE r0."Id" > @get_Item_Id AND r0."Id" = @entity_equality_get_Item_Id AND r0."Int" = @entity_equality_get_Item_Int AND r0."Ints" = @entity_equality_get_Item_Ints AND r0."Name" = @entity_equality_get_Item_Name AND r0."String" = @entity_equality_get_Item_String AND (r0."NestedCollection") = @entity_equality_get_Item_NestedCollection AND (r0."OptionalNested") = @entity_equality_get_Item_OptionalNested AND (r0."RequiredNested") = @entity_equality_get_Item_RequiredNested) + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a + WHERE a."Id" > @get_Item_Id AND a."Id" = @entity_equality_get_Item_Id AND a."Int" = @entity_equality_get_Item_Int AND a."Ints" = @entity_equality_get_Item_Ints AND a."Name" = @entity_equality_get_Item_Name AND a."String" = @entity_equality_get_Item_String AND (a."NestedCollection") = @entity_equality_get_Item_NestedCollection AND (a."OptionalNestedAssociate") = @entity_equality_get_Item_OptionalNestedAssociate AND (a."RequiredNestedAssociate") = @entity_equality_get_Item_RequiredNestedAssociate) """); }); } @@ -290,9 +290,9 @@ public override async Task Nullable_value_type_with_null() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated", v."RelatedCollection", v."RequiredRelated" +SELECT v."Id", v."Name", v."AssociateCollection", v."OptionalAssociate", v."RequiredAssociate" FROM "ValueRootEntity" AS v -WHERE (v."OptionalRelated") IS NULL +WHERE (v."OptionalAssociate") IS NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateNpgsqlTest.cs index aed87c791..e338cb80c 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateNpgsqlTest.cs @@ -20,16 +20,16 @@ DELETE FROM "RootEntity" AS r """); } - public override async Task Delete_required_association() + public override async Task Delete_required_associate() { - await base.Delete_required_association(); + await base.Delete_required_associate(); AssertSql(); } - public override async Task Delete_optional_association() + public override async Task Delete_optional_associate() { - await base.Delete_optional_association(); + await base.Delete_optional_associate(); AssertSql(); } @@ -38,60 +38,67 @@ public override async Task Delete_optional_association() #region Update properties - public override async Task Update_property_inside_association() + public override async Task Update_property_inside_associate() { - await base.Update_property_inside_association(); + await base.Update_property_inside_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_String" = @p +SET "RequiredAssociate_String" = @p """); } - public override async Task Update_property_inside_association_with_special_chars() + public override async Task Update_property_inside_associate_with_special_chars() { - await base.Update_property_inside_association_with_special_chars(); + await base.Update_property_inside_associate_with_special_chars(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_String" = '{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }' -WHERE r."RequiredRelated_String" = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' +SET "RequiredAssociate_String" = '{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }' +WHERE r."RequiredAssociate_String" = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' """); } - public override async Task Update_property_inside_nested() + public override async Task Update_property_inside_nested_associate() { - await base.Update_property_inside_nested(); + await base.Update_property_inside_nested_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_RequiredNested_String" = @p +SET "RequiredAssociate_RequiredNestedAssociate_String" = @p """); } - public override async Task Update_property_on_projected_association() + public override async Task Update_property_on_projected_associate() { - await base.Update_property_on_projected_association(); + await base.Update_property_on_projected_associate(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_String" = @p +SET "RequiredAssociate_String" = @p """); } - public override async Task Update_property_on_projected_association_with_OrderBy_Skip() + public override async Task Update_property_on_projected_associate_with_OrderBy_Skip() { - await base.Update_property_on_projected_association_with_OrderBy_Skip(); + await base.Update_property_on_projected_associate_with_OrderBy_Skip(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_associate_with_null_required_property() + { + await base.Update_associate_with_null_required_property(); AssertExecuteUpdateSql(); } @@ -100,9 +107,9 @@ public override async Task Update_property_on_projected_association_with_OrderBy #region Update association - public override async Task Update_association_to_parameter() + public override async Task Update_associate_to_parameter() { - await base.Update_association_to_parameter(); + await base.Update_associate_to_parameter(); AssertExecuteUpdateSql( """ @@ -111,29 +118,34 @@ public override async Task Update_association_to_parameter() @complex_type_p_Ints='?' (DbType = Object) @complex_type_p_Name='?' @complex_type_p_String='?' +@complex_type_p_RequiredNestedAssociate_Id='?' (DbType = Int32) +@complex_type_p_RequiredNestedAssociate_Int='?' (DbType = Int32) +@complex_type_p_RequiredNestedAssociate_Ints='?' (DbType = Object) +@complex_type_p_RequiredNestedAssociate_Name='?' +@complex_type_p_RequiredNestedAssociate_String='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_Id" = @complex_type_p_Id, - "RequiredRelated_Int" = @complex_type_p_Int, - "RequiredRelated_Ints" = @complex_type_p_Ints, - "RequiredRelated_Name" = @complex_type_p_Name, - "RequiredRelated_String" = @complex_type_p_String, - "RequiredRelated_OptionalNested_Id" = @complex_type_p_Id, - "RequiredRelated_OptionalNested_Int" = @complex_type_p_Int, - "RequiredRelated_OptionalNested_Ints" = @complex_type_p_Ints, - "RequiredRelated_OptionalNested_Name" = @complex_type_p_Name, - "RequiredRelated_OptionalNested_String" = @complex_type_p_String, - "RequiredRelated_RequiredNested_Id" = @complex_type_p_Id, - "RequiredRelated_RequiredNested_Int" = @complex_type_p_Int, - "RequiredRelated_RequiredNested_Ints" = @complex_type_p_Ints, - "RequiredRelated_RequiredNested_Name" = @complex_type_p_Name, - "RequiredRelated_RequiredNested_String" = @complex_type_p_String +SET "RequiredAssociate_Id" = @complex_type_p_Id, + "RequiredAssociate_Int" = @complex_type_p_Int, + "RequiredAssociate_Ints" = @complex_type_p_Ints, + "RequiredAssociate_Name" = @complex_type_p_Name, + "RequiredAssociate_String" = @complex_type_p_String, + "RequiredAssociate_OptionalNestedAssociate_Id" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Int" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Ints" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Name" = NULL, + "RequiredAssociate_OptionalNestedAssociate_String" = NULL, + "RequiredAssociate_RequiredNestedAssociate_Id" = @complex_type_p_RequiredNestedAssociate_Id, + "RequiredAssociate_RequiredNestedAssociate_Int" = @complex_type_p_RequiredNestedAssociate_Int, + "RequiredAssociate_RequiredNestedAssociate_Ints" = @complex_type_p_RequiredNestedAssociate_Ints, + "RequiredAssociate_RequiredNestedAssociate_Name" = @complex_type_p_RequiredNestedAssociate_Name, + "RequiredAssociate_RequiredNestedAssociate_String" = @complex_type_p_RequiredNestedAssociate_String """); } - public override async Task Update_nested_association_to_parameter() + public override async Task Update_nested_associate_to_parameter() { - await base.Update_nested_association_to_parameter(); + await base.Update_nested_associate_to_parameter(); AssertExecuteUpdateSql( """ @@ -144,57 +156,57 @@ public override async Task Update_nested_association_to_parameter() @complex_type_p_String='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_RequiredNested_Id" = @complex_type_p_Id, - "RequiredRelated_RequiredNested_Int" = @complex_type_p_Int, - "RequiredRelated_RequiredNested_Ints" = @complex_type_p_Ints, - "RequiredRelated_RequiredNested_Name" = @complex_type_p_Name, - "RequiredRelated_RequiredNested_String" = @complex_type_p_String +SET "RequiredAssociate_RequiredNestedAssociate_Id" = @complex_type_p_Id, + "RequiredAssociate_RequiredNestedAssociate_Int" = @complex_type_p_Int, + "RequiredAssociate_RequiredNestedAssociate_Ints" = @complex_type_p_Ints, + "RequiredAssociate_RequiredNestedAssociate_Name" = @complex_type_p_Name, + "RequiredAssociate_RequiredNestedAssociate_String" = @complex_type_p_String """); } - public override async Task Update_association_to_another_association() + public override async Task Update_associate_to_another_associate() { - await base.Update_association_to_another_association(); + await base.Update_associate_to_another_associate(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated_Id" = r."RequiredRelated_Id", - "OptionalRelated_Int" = r."RequiredRelated_Int", - "OptionalRelated_Ints" = r."RequiredRelated_Ints", - "OptionalRelated_Name" = r."RequiredRelated_Name", - "OptionalRelated_String" = r."RequiredRelated_String", - "OptionalRelated_OptionalNested_Id" = r."OptionalRelated_OptionalNested_Id", - "OptionalRelated_OptionalNested_Int" = r."OptionalRelated_OptionalNested_Int", - "OptionalRelated_OptionalNested_Ints" = r."OptionalRelated_OptionalNested_Ints", - "OptionalRelated_OptionalNested_Name" = r."OptionalRelated_OptionalNested_Name", - "OptionalRelated_OptionalNested_String" = r."OptionalRelated_OptionalNested_String", - "OptionalRelated_RequiredNested_Id" = r."OptionalRelated_RequiredNested_Id", - "OptionalRelated_RequiredNested_Int" = r."OptionalRelated_RequiredNested_Int", - "OptionalRelated_RequiredNested_Ints" = r."OptionalRelated_RequiredNested_Ints", - "OptionalRelated_RequiredNested_Name" = r."OptionalRelated_RequiredNested_Name", - "OptionalRelated_RequiredNested_String" = r."OptionalRelated_RequiredNested_String" +SET "OptionalAssociate_Id" = r."RequiredAssociate_Id", + "OptionalAssociate_Int" = r."RequiredAssociate_Int", + "OptionalAssociate_Ints" = r."RequiredAssociate_Ints", + "OptionalAssociate_Name" = r."RequiredAssociate_Name", + "OptionalAssociate_String" = r."RequiredAssociate_String", + "OptionalAssociate_OptionalNestedAssociate_Id" = r."OptionalAssociate_OptionalNestedAssociate_Id", + "OptionalAssociate_OptionalNestedAssociate_Int" = r."OptionalAssociate_OptionalNestedAssociate_Int", + "OptionalAssociate_OptionalNestedAssociate_Ints" = r."OptionalAssociate_OptionalNestedAssociate_Ints", + "OptionalAssociate_OptionalNestedAssociate_Name" = r."OptionalAssociate_OptionalNestedAssociate_Name", + "OptionalAssociate_OptionalNestedAssociate_String" = r."OptionalAssociate_OptionalNestedAssociate_String", + "OptionalAssociate_RequiredNestedAssociate_Id" = r."OptionalAssociate_RequiredNestedAssociate_Id", + "OptionalAssociate_RequiredNestedAssociate_Int" = r."OptionalAssociate_RequiredNestedAssociate_Int", + "OptionalAssociate_RequiredNestedAssociate_Ints" = r."OptionalAssociate_RequiredNestedAssociate_Ints", + "OptionalAssociate_RequiredNestedAssociate_Name" = r."OptionalAssociate_RequiredNestedAssociate_Name", + "OptionalAssociate_RequiredNestedAssociate_String" = r."OptionalAssociate_RequiredNestedAssociate_String" """); } - public override async Task Update_nested_association_to_another_nested_association() + public override async Task Update_nested_associate_to_another_nested_associate() { - await base.Update_nested_association_to_another_nested_association(); + await base.Update_nested_associate_to_another_nested_associate(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_OptionalNested_Id" = r."RequiredRelated_RequiredNested_Id", - "RequiredRelated_OptionalNested_Int" = r."RequiredRelated_RequiredNested_Int", - "RequiredRelated_OptionalNested_Ints" = r."RequiredRelated_RequiredNested_Ints", - "RequiredRelated_OptionalNested_Name" = r."RequiredRelated_RequiredNested_Name", - "RequiredRelated_OptionalNested_String" = r."RequiredRelated_RequiredNested_String" +SET "RequiredAssociate_OptionalNestedAssociate_Id" = r."RequiredAssociate_RequiredNestedAssociate_Id", + "RequiredAssociate_OptionalNestedAssociate_Int" = r."RequiredAssociate_RequiredNestedAssociate_Int", + "RequiredAssociate_OptionalNestedAssociate_Ints" = r."RequiredAssociate_RequiredNestedAssociate_Ints", + "RequiredAssociate_OptionalNestedAssociate_Name" = r."RequiredAssociate_RequiredNestedAssociate_Name", + "RequiredAssociate_OptionalNestedAssociate_String" = r."RequiredAssociate_RequiredNestedAssociate_String" """); } - public override async Task Update_association_to_inline() + public override async Task Update_associate_to_inline() { - await base.Update_association_to_inline(); + await base.Update_associate_to_inline(); AssertExecuteUpdateSql( """ @@ -203,141 +215,153 @@ public override async Task Update_association_to_inline() @complex_type_p_Ints='?' (DbType = Object) @complex_type_p_Name='?' @complex_type_p_String='?' +@complex_type_p_RequiredNestedAssociate_Id='?' (DbType = Int32) +@complex_type_p_RequiredNestedAssociate_Int='?' (DbType = Int32) +@complex_type_p_RequiredNestedAssociate_Ints='?' (DbType = Object) +@complex_type_p_RequiredNestedAssociate_Name='?' +@complex_type_p_RequiredNestedAssociate_String='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_Id" = @complex_type_p_Id, - "RequiredRelated_Int" = @complex_type_p_Int, - "RequiredRelated_Ints" = @complex_type_p_Ints, - "RequiredRelated_Name" = @complex_type_p_Name, - "RequiredRelated_String" = @complex_type_p_String, - "RequiredRelated_OptionalNested_Id" = @complex_type_p_Id, - "RequiredRelated_OptionalNested_Int" = @complex_type_p_Int, - "RequiredRelated_OptionalNested_Ints" = @complex_type_p_Ints, - "RequiredRelated_OptionalNested_Name" = @complex_type_p_Name, - "RequiredRelated_OptionalNested_String" = @complex_type_p_String, - "RequiredRelated_RequiredNested_Id" = @complex_type_p_Id, - "RequiredRelated_RequiredNested_Int" = @complex_type_p_Int, - "RequiredRelated_RequiredNested_Ints" = @complex_type_p_Ints, - "RequiredRelated_RequiredNested_Name" = @complex_type_p_Name, - "RequiredRelated_RequiredNested_String" = @complex_type_p_String +SET "RequiredAssociate_Id" = @complex_type_p_Id, + "RequiredAssociate_Int" = @complex_type_p_Int, + "RequiredAssociate_Ints" = @complex_type_p_Ints, + "RequiredAssociate_Name" = @complex_type_p_Name, + "RequiredAssociate_String" = @complex_type_p_String, + "RequiredAssociate_OptionalNestedAssociate_Id" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Int" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Ints" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Name" = NULL, + "RequiredAssociate_OptionalNestedAssociate_String" = NULL, + "RequiredAssociate_RequiredNestedAssociate_Id" = @complex_type_p_RequiredNestedAssociate_Id, + "RequiredAssociate_RequiredNestedAssociate_Int" = @complex_type_p_RequiredNestedAssociate_Int, + "RequiredAssociate_RequiredNestedAssociate_Ints" = @complex_type_p_RequiredNestedAssociate_Ints, + "RequiredAssociate_RequiredNestedAssociate_Name" = @complex_type_p_RequiredNestedAssociate_Name, + "RequiredAssociate_RequiredNestedAssociate_String" = @complex_type_p_RequiredNestedAssociate_String """); } - public override async Task Update_association_to_inline_with_lambda() + public override async Task Update_associate_to_inline_with_lambda() { - await base.Update_association_to_inline_with_lambda(); + await base.Update_associate_to_inline_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_Id" = 1000, - "RequiredRelated_Int" = 70, - "RequiredRelated_Ints" = ARRAY[1,2,4]::integer[], - "RequiredRelated_Name" = 'Updated related name', - "RequiredRelated_String" = 'Updated related string', - "RequiredRelated_OptionalNested_Id" = NULL, - "RequiredRelated_OptionalNested_Int" = NULL, - "RequiredRelated_OptionalNested_Ints" = NULL, - "RequiredRelated_OptionalNested_Name" = NULL, - "RequiredRelated_OptionalNested_String" = NULL, - "RequiredRelated_RequiredNested_Id" = 1000, - "RequiredRelated_RequiredNested_Int" = 80, - "RequiredRelated_RequiredNested_Ints" = ARRAY[1,2,4]::integer[], - "RequiredRelated_RequiredNested_Name" = 'Updated nested name', - "RequiredRelated_RequiredNested_String" = 'Updated nested string' +SET "RequiredAssociate_Id" = 1000, + "RequiredAssociate_Int" = 70, + "RequiredAssociate_Ints" = ARRAY[1,2,4]::integer[], + "RequiredAssociate_Name" = 'Updated associate name', + "RequiredAssociate_String" = 'Updated associate string', + "RequiredAssociate_OptionalNestedAssociate_Id" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Int" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Ints" = NULL, + "RequiredAssociate_OptionalNestedAssociate_Name" = NULL, + "RequiredAssociate_OptionalNestedAssociate_String" = NULL, + "RequiredAssociate_RequiredNestedAssociate_Id" = 1000, + "RequiredAssociate_RequiredNestedAssociate_Int" = 80, + "RequiredAssociate_RequiredNestedAssociate_Ints" = ARRAY[1,2,4]::integer[], + "RequiredAssociate_RequiredNestedAssociate_Name" = 'Updated nested name', + "RequiredAssociate_RequiredNestedAssociate_String" = 'Updated nested string' """); } - public override async Task Update_nested_association_to_inline_with_lambda() + public override async Task Update_nested_associate_to_inline_with_lambda() { - await base.Update_nested_association_to_inline_with_lambda(); + await base.Update_nested_associate_to_inline_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_RequiredNested_Id" = 1000, - "RequiredRelated_RequiredNested_Int" = 80, - "RequiredRelated_RequiredNested_Ints" = ARRAY[1,2,4]::integer[], - "RequiredRelated_RequiredNested_Name" = 'Updated nested name', - "RequiredRelated_RequiredNested_String" = 'Updated nested string' +SET "RequiredAssociate_RequiredNestedAssociate_Id" = 1000, + "RequiredAssociate_RequiredNestedAssociate_Int" = 80, + "RequiredAssociate_RequiredNestedAssociate_Ints" = ARRAY[1,2,4]::integer[], + "RequiredAssociate_RequiredNestedAssociate_Name" = 'Updated nested name', + "RequiredAssociate_RequiredNestedAssociate_String" = 'Updated nested string' """); } - public override async Task Update_association_to_null() + public override async Task Update_associate_to_null() { - await base.Update_association_to_null(); + await base.Update_associate_to_null(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated_Id" = NULL, - "OptionalRelated_Int" = NULL, - "OptionalRelated_Ints" = NULL, - "OptionalRelated_Name" = NULL, - "OptionalRelated_String" = NULL, - "OptionalRelated_OptionalNested_Id" = NULL, - "OptionalRelated_OptionalNested_Int" = NULL, - "OptionalRelated_OptionalNested_Ints" = NULL, - "OptionalRelated_OptionalNested_Name" = NULL, - "OptionalRelated_OptionalNested_String" = NULL, - "OptionalRelated_RequiredNested_Id" = NULL, - "OptionalRelated_RequiredNested_Int" = NULL, - "OptionalRelated_RequiredNested_Ints" = NULL, - "OptionalRelated_RequiredNested_Name" = NULL, - "OptionalRelated_RequiredNested_String" = NULL +SET "OptionalAssociate_Id" = NULL, + "OptionalAssociate_Int" = NULL, + "OptionalAssociate_Ints" = NULL, + "OptionalAssociate_Name" = NULL, + "OptionalAssociate_String" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Id" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Int" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Ints" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Name" = NULL, + "OptionalAssociate_OptionalNestedAssociate_String" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Id" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Int" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Ints" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Name" = NULL, + "OptionalAssociate_RequiredNestedAssociate_String" = NULL """); } - public override async Task Update_association_to_null_with_lambda() + public override async Task Update_associate_to_null_with_lambda() { - await base.Update_association_to_null_with_lambda(); + await base.Update_associate_to_null_with_lambda(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated_Id" = NULL, - "OptionalRelated_Int" = NULL, - "OptionalRelated_Ints" = NULL, - "OptionalRelated_Name" = NULL, - "OptionalRelated_String" = NULL, - "OptionalRelated_OptionalNested_Id" = NULL, - "OptionalRelated_OptionalNested_Int" = NULL, - "OptionalRelated_OptionalNested_Ints" = NULL, - "OptionalRelated_OptionalNested_Name" = NULL, - "OptionalRelated_OptionalNested_String" = NULL, - "OptionalRelated_RequiredNested_Id" = NULL, - "OptionalRelated_RequiredNested_Int" = NULL, - "OptionalRelated_RequiredNested_Ints" = NULL, - "OptionalRelated_RequiredNested_Name" = NULL, - "OptionalRelated_RequiredNested_String" = NULL +SET "OptionalAssociate_Id" = NULL, + "OptionalAssociate_Int" = NULL, + "OptionalAssociate_Ints" = NULL, + "OptionalAssociate_Name" = NULL, + "OptionalAssociate_String" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Id" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Int" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Ints" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Name" = NULL, + "OptionalAssociate_OptionalNestedAssociate_String" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Id" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Int" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Ints" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Name" = NULL, + "OptionalAssociate_RequiredNestedAssociate_String" = NULL """); } - public override async Task Update_association_to_null_parameter() + public override async Task Update_associate_to_null_parameter() { - await base.Update_association_to_null_parameter(); + await base.Update_associate_to_null_parameter(); AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "OptionalRelated_Id" = NULL, - "OptionalRelated_Int" = NULL, - "OptionalRelated_Ints" = NULL, - "OptionalRelated_Name" = NULL, - "OptionalRelated_String" = NULL, - "OptionalRelated_OptionalNested_Id" = NULL, - "OptionalRelated_OptionalNested_Int" = NULL, - "OptionalRelated_OptionalNested_Ints" = NULL, - "OptionalRelated_OptionalNested_Name" = NULL, - "OptionalRelated_OptionalNested_String" = NULL, - "OptionalRelated_RequiredNested_Id" = NULL, - "OptionalRelated_RequiredNested_Int" = NULL, - "OptionalRelated_RequiredNested_Ints" = NULL, - "OptionalRelated_RequiredNested_Name" = NULL, - "OptionalRelated_RequiredNested_String" = NULL +SET "OptionalAssociate_Id" = NULL, + "OptionalAssociate_Int" = NULL, + "OptionalAssociate_Ints" = NULL, + "OptionalAssociate_Name" = NULL, + "OptionalAssociate_String" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Id" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Int" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Ints" = NULL, + "OptionalAssociate_OptionalNestedAssociate_Name" = NULL, + "OptionalAssociate_OptionalNestedAssociate_String" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Id" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Int" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Ints" = NULL, + "OptionalAssociate_RequiredNestedAssociate_Name" = NULL, + "OptionalAssociate_RequiredNestedAssociate_String" = NULL """); } + public override async Task Update_required_nested_associate_to_null() + { + await base.Update_required_nested_associate_to_null(); + + AssertExecuteUpdateSql(); + } + #endregion Update association #region Update collection @@ -395,7 +419,7 @@ public override async Task Update_primitive_collection_to_constant() AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_Ints" = ARRAY[1,2,4]::integer[] +SET "RequiredAssociate_Ints" = ARRAY[1,2,4]::integer[] """); } @@ -408,7 +432,7 @@ public override async Task Update_primitive_collection_to_parameter() @ints='?' (DbType = Object) UPDATE "RootEntity" AS r -SET "RequiredRelated_Ints" = @ints +SET "RequiredAssociate_Ints" = @ints """); } @@ -419,7 +443,7 @@ public override async Task Update_primitive_collection_to_another_collection() AssertExecuteUpdateSql( """ UPDATE "RootEntity" AS r -SET "RequiredRelated_OptionalNested_Ints" = r."RequiredRelated_RequiredNested_Ints" +SET "RequiredAssociate_OptionalNestedAssociate_Ints" = r."RequiredAssociate_RequiredNestedAssociate_Ints" """); } @@ -435,9 +459,9 @@ public override async Task Update_inside_primitive_collection() #region Multiple updates - public override async Task Update_multiple_properties_inside_same_association() + public override async Task Update_multiple_properties_inside_same_associate() { - await base.Update_multiple_properties_inside_same_association(); + await base.Update_multiple_properties_inside_same_associate(); AssertExecuteUpdateSql( """ @@ -445,14 +469,14 @@ public override async Task Update_multiple_properties_inside_same_association() @p0='?' (DbType = Int32) UPDATE "RootEntity" AS r -SET "RequiredRelated_String" = @p, - "RequiredRelated_Int" = @p0 +SET "RequiredAssociate_String" = @p, + "RequiredAssociate_Int" = @p0 """); } - public override async Task Update_multiple_properties_inside_associations_and_on_entity_type() + public override async Task Update_multiple_properties_inside_associates_and_on_entity_type() { - await base.Update_multiple_properties_inside_associations_and_on_entity_type(); + await base.Update_multiple_properties_inside_associates_and_on_entity_type(); AssertExecuteUpdateSql( """ @@ -460,24 +484,24 @@ public override async Task Update_multiple_properties_inside_associations_and_on UPDATE "RootEntity" AS r SET "Name" = r."Name" || 'Modified', - "RequiredRelated_String" = r."OptionalRelated_String", - "OptionalRelated_RequiredNested_String" = @p -WHERE r."OptionalRelated_Id" IS NOT NULL + "RequiredAssociate_String" = r."OptionalAssociate_String", + "OptionalAssociate_RequiredNestedAssociate_String" = @p +WHERE r."OptionalAssociate_Id" IS NOT NULL """); } - public override async Task Update_multiple_projected_associations_via_anonymous_type() + public override async Task Update_multiple_projected_associates_via_anonymous_type() { - await base.Update_multiple_projected_associations_via_anonymous_type(); + await base.Update_multiple_projected_associates_via_anonymous_type(); AssertExecuteUpdateSql( """ @p='?' UPDATE "RootEntity" AS r -SET "RequiredRelated_String" = r."OptionalRelated_String", - "OptionalRelated_String" = @p -WHERE r."OptionalRelated_Id" IS NOT NULL +SET "RequiredAssociate_String" = r."OptionalAssociate_String", + "OptionalAssociate_String" = @p +WHERE r."OptionalAssociate_Id" IS NOT NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs index b7e396df5..7c32a1764 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousNpgsqlTest.cs @@ -8,39 +8,39 @@ public class ComplexTableSplittingMiscellaneousNpgsqlTest( ITestOutputHelper testOutputHelper) : ComplexTableSplittingMiscellaneousRelationalTestBase(fixture, testOutputHelper) { - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_Int" = 8 +WHERE r."RequiredAssociate_Int" = 8 """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."OptionalRelated_Int" = 8 +WHERE r."OptionalAssociate_Int" = 8 """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_RequiredNested_Int" = 8 +WHERE r."RequiredAssociate_RequiredNestedAssociate_Int" = 8 """); } @@ -52,9 +52,9 @@ public override async Task Where_property_on_non_nullable_value_type() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String", v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."Id", v."Name", v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String", v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v -WHERE v."RequiredRelated_Int" = 8 +WHERE v."RequiredAssociate_Int" = 8 """); } @@ -64,9 +64,9 @@ public override async Task Where_property_on_nullable_value_type_Value() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String", v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."Id", v."Name", v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String", v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v -WHERE v."OptionalRelated_Int" = 8 +WHERE v."OptionalAssociate_Int" = 8 """); } @@ -76,9 +76,9 @@ public override async Task Where_HasValue_on_nullable_value_type() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String", v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."Id", v."Name", v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String", v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v -WHERE v."OptionalRelated_Id" IS NOT NULL +WHERE v."OptionalAssociate_Id" IS NOT NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionNpgsqlTest.cs index b865eeeb5..1ff527a6b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionNpgsqlTest.cs @@ -9,9 +9,9 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE cardinality(r."RequiredRelated_Ints") = 3 +WHERE cardinality(r."RequiredAssociate_Ints") = 3 """); } @@ -21,9 +21,9 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_Ints"[1] = 1 +WHERE r."RequiredAssociate_Ints"[1] = 1 """); } @@ -33,9 +33,9 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE 3 = ANY (r."RequiredRelated_Ints") +WHERE 3 = ANY (r."RequiredAssociate_Ints") """); } @@ -45,9 +45,9 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE 2 = ANY (r."RequiredRelated_Ints") +WHERE 2 = ANY (r."RequiredAssociate_Ints") """); } @@ -57,9 +57,9 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE cardinality(r."RequiredRelated_RequiredNested_Ints") = 3 +WHERE cardinality(r."RequiredAssociate_RequiredNestedAssociate_Ints") = 3 """); } @@ -71,11 +71,11 @@ public override async Task Select_Sum() """ SELECT ( SELECT COALESCE(sum(r1.value), 0)::int - FROM unnest(r."RequiredRelated_Ints") AS r1(value)) + FROM unnest(r."RequiredAssociate_Ints") AS r1(value)) FROM "RootEntity" AS r WHERE ( SELECT COALESCE(sum(r0.value), 0)::int - FROM unnest(r."RequiredRelated_Ints") AS r0(value)) >= 6 + FROM unnest(r."RequiredAssociate_Ints") AS r0(value)) >= 6 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs index 16d60b83c..87a40359b 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionNpgsqlTest.cs @@ -8,217 +8,260 @@ public class ComplexTableSplittingProjectionNpgsqlTest( ITestOutputHelper testOutputHelper) : ComplexTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) { - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_root(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."RequiredAssociate_String" FROM "RootEntity" AS r -ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_root(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."OptionalAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated_String" +SELECT r."OptionalAssociate_Int" FROM "RootEntity" AS r """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_String" +SELECT r."OptionalAssociate_Int" FROM "RootEntity" AS r """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_Int" +SELECT r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_Int" +SELECT r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +SELECT r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String" +SELECT r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +SELECT r0."RequiredAssociate_Id", r0."RequiredAssociate_Int", r0."RequiredAssociate_Ints", r0."RequiredAssociate_Name", r0."RequiredAssociate_String", r0."RequiredAssociate_OptionalNestedAssociate_Id", r0."RequiredAssociate_OptionalNestedAssociate_Int", r0."RequiredAssociate_OptionalNestedAssociate_Ints", r0."RequiredAssociate_OptionalNestedAssociate_Name", r0."RequiredAssociate_OptionalNestedAssociate_String", r0."RequiredAssociate_RequiredNestedAssociate_Id", r0."RequiredAssociate_RequiredNestedAssociate_Int", r0."RequiredAssociate_RequiredNestedAssociate_Ints", r0."RequiredAssociate_RequiredNestedAssociate_Name", r0."RequiredAssociate_RequiredNestedAssociate_String" +FROM "RootReferencingEntity" AS r +LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +"""); + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String" +SELECT r."RequiredAssociate_Int" FROM "RootEntity" AS r """); } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); AssertSql( """ -SELECT r0."RequiredRelated_Id", r0."RequiredRelated_Int", r0."RequiredRelated_Ints", r0."RequiredRelated_Name", r0."RequiredRelated_String", r0."RequiredRelated_OptionalNested_Id", r0."RequiredRelated_OptionalNested_Int", r0."RequiredRelated_OptionalNested_Ints", r0."RequiredRelated_OptionalNested_Name", r0."RequiredRelated_OptionalNested_String", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Ints", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" -FROM "RootReferencingEntity" AS r -LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST +"""); + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" +FROM "RootEntity" AS r +ORDER BY r."Id" NULLS FIRST """); } - public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); - AssertSql(); + AssertSql( +); } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); - AssertSql(); + AssertSql( +); } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); - AssertSql(); + AssertSql( +); } + #endregion Structural collection properties + + #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_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" 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."RequiredRelated_RequiredNested_Id", r1."RequiredRelated_RequiredNested_Int", r1."RequiredRelated_RequiredNested_Ints", r1."RequiredRelated_RequiredNested_Name", r1."RequiredRelated_RequiredNested_String" +SELECT r1."RequiredAssociate_RequiredNestedAssociate_Id", r1."RequiredAssociate_RequiredNestedAssociate_Int", r1."RequiredAssociate_RequiredNestedAssociate_Ints", r1."RequiredAssociate_RequiredNestedAssociate_Name", r1."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Ints", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" + SELECT r0."RequiredAssociate_RequiredNestedAssociate_Id", r0."RequiredAssociate_RequiredNestedAssociate_Int", r0."RequiredAssociate_RequiredNestedAssociate_Ints", r0."RequiredAssociate_RequiredNestedAssociate_Name", r0."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -232,10 +275,10 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query AssertSql( """ -SELECT r1."OptionalRelated_RequiredNested_Id", r1."OptionalRelated_RequiredNested_Int", r1."OptionalRelated_RequiredNested_Ints", r1."OptionalRelated_RequiredNested_Name", r1."OptionalRelated_RequiredNested_String" +SELECT r1."OptionalAssociate_RequiredNestedAssociate_Id", r1."OptionalAssociate_RequiredNestedAssociate_Int", r1."OptionalAssociate_RequiredNestedAssociate_Ints", r1."OptionalAssociate_RequiredNestedAssociate_Name", r1."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."OptionalRelated_RequiredNested_Id", r0."OptionalRelated_RequiredNested_Int", r0."OptionalRelated_RequiredNested_Ints", r0."OptionalRelated_RequiredNested_Name", r0."OptionalRelated_RequiredNested_String" + SELECT r0."OptionalAssociate_RequiredNestedAssociate_Id", r0."OptionalAssociate_RequiredNestedAssociate_Int", r0."OptionalAssociate_RequiredNestedAssociate_Ints", r0."OptionalAssociate_RequiredNestedAssociate_Name", r0."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -243,6 +286,8 @@ LIMIT 1 """); } + #endregion Subquery + #region Value types public override async Task Select_root_with_value_types(QueryTrackingBehavior queryTrackingBehavior) @@ -251,7 +296,7 @@ public override async Task Select_root_with_value_types(QueryTrackingBehavior qu AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String", v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."Id", v."Name", v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String", v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v """); } @@ -262,7 +307,7 @@ public override async Task Select_non_nullable_value_type(QueryTrackingBehavior AssertSql( """ -SELECT v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); @@ -274,7 +319,7 @@ public override async Task Select_nullable_value_type(QueryTrackingBehavior quer AssertSql( """ -SELECT v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String" +SELECT v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); @@ -286,7 +331,7 @@ public override async Task Select_nullable_value_type_with_Value(QueryTrackingBe AssertSql( """ -SELECT v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String" +SELECT v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v ORDER BY v."Id" NULLS FIRST """); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs index 599d6eddc..6cb2d912c 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityNpgsqlTest.cs @@ -8,27 +8,27 @@ public class ComplexTableSplittingStructuralEqualityNpgsqlTest( ITestOutputHelper testOutputHelper) : ComplexTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) { - public override async Task Two_related() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_Id" = r."OptionalRelated_Id" AND r."RequiredRelated_Int" = r."OptionalRelated_Int" AND r."RequiredRelated_Ints" = r."OptionalRelated_Ints" 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_Ints" = r."RequiredRelated_OptionalNested_Ints" OR r."RequiredRelated_OptionalNested_Ints" 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_Ints" = r."RequiredRelated_RequiredNested_Ints" AND r."RequiredRelated_RequiredNested_Name" = r."RequiredRelated_RequiredNested_Name" AND r."RequiredRelated_RequiredNested_String" = r."RequiredRelated_RequiredNested_String" +WHERE r."RequiredAssociate_Id" = r."OptionalAssociate_Id" AND r."RequiredAssociate_Int" = r."OptionalAssociate_Int" AND r."RequiredAssociate_Ints" = r."OptionalAssociate_Ints" AND r."RequiredAssociate_Name" = r."OptionalAssociate_Name" AND r."RequiredAssociate_String" = r."OptionalAssociate_String" AND (r."RequiredAssociate_OptionalNestedAssociate_Id" = r."RequiredAssociate_OptionalNestedAssociate_Id" OR r."RequiredAssociate_OptionalNestedAssociate_Id" IS NULL) AND (r."RequiredAssociate_OptionalNestedAssociate_Int" = r."RequiredAssociate_OptionalNestedAssociate_Int" OR r."RequiredAssociate_OptionalNestedAssociate_Int" IS NULL) AND (r."RequiredAssociate_OptionalNestedAssociate_Ints" = r."RequiredAssociate_OptionalNestedAssociate_Ints" OR r."RequiredAssociate_OptionalNestedAssociate_Ints" IS NULL) AND (r."RequiredAssociate_OptionalNestedAssociate_Name" = r."RequiredAssociate_OptionalNestedAssociate_Name" OR r."RequiredAssociate_OptionalNestedAssociate_Name" IS NULL) AND (r."RequiredAssociate_OptionalNestedAssociate_String" = r."RequiredAssociate_OptionalNestedAssociate_String" OR r."RequiredAssociate_OptionalNestedAssociate_String" IS NULL) AND r."RequiredAssociate_RequiredNestedAssociate_Id" = r."RequiredAssociate_RequiredNestedAssociate_Id" AND r."RequiredAssociate_RequiredNestedAssociate_Int" = r."RequiredAssociate_RequiredNestedAssociate_Int" AND r."RequiredAssociate_RequiredNestedAssociate_Ints" = r."RequiredAssociate_RequiredNestedAssociate_Ints" AND r."RequiredAssociate_RequiredNestedAssociate_Name" = r."RequiredAssociate_RequiredNestedAssociate_Name" AND r."RequiredAssociate_RequiredNestedAssociate_String" = r."RequiredAssociate_RequiredNestedAssociate_String" """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" = r."OptionalRelated_RequiredNested_Ints" AND r."RequiredRelated_RequiredNested_Name" = r."OptionalRelated_RequiredNested_Name" AND r."RequiredRelated_RequiredNested_String" = r."OptionalRelated_RequiredNested_String" +WHERE r."RequiredAssociate_RequiredNestedAssociate_Id" = r."OptionalAssociate_RequiredNestedAssociate_Id" AND r."RequiredAssociate_RequiredNestedAssociate_Int" = r."OptionalAssociate_RequiredNestedAssociate_Int" AND r."RequiredAssociate_RequiredNestedAssociate_Ints" = r."OptionalAssociate_RequiredNestedAssociate_Ints" AND r."RequiredAssociate_RequiredNestedAssociate_Name" = r."OptionalAssociate_RequiredNestedAssociate_Name" AND r."RequiredAssociate_RequiredNestedAssociate_String" = r."OptionalAssociate_RequiredNestedAssociate_String" """); } @@ -38,63 +38,63 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" <> r."OptionalRelated_Ints" OR r."OptionalRelated_Ints" 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_Ints" <> r."RequiredRelated_OptionalNested_Ints" OR r."RequiredRelated_OptionalNested_Ints" IS NULL) AND r."RequiredRelated_OptionalNested_Ints" 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_Ints" <> r."RequiredRelated_RequiredNested_Ints" OR r."RequiredRelated_RequiredNested_Ints" 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 +WHERE r."RequiredAssociate_Id" <> r."OptionalAssociate_Id" OR r."OptionalAssociate_Id" IS NULL OR r."RequiredAssociate_Int" <> r."OptionalAssociate_Int" OR r."OptionalAssociate_Int" IS NULL OR r."RequiredAssociate_Ints" <> r."OptionalAssociate_Ints" OR r."OptionalAssociate_Ints" IS NULL OR r."RequiredAssociate_Name" <> r."OptionalAssociate_Name" OR r."OptionalAssociate_Name" IS NULL OR r."RequiredAssociate_String" <> r."OptionalAssociate_String" OR r."OptionalAssociate_String" IS NULL OR ((r."RequiredAssociate_OptionalNestedAssociate_Id" <> r."RequiredAssociate_OptionalNestedAssociate_Id" OR r."RequiredAssociate_OptionalNestedAssociate_Id" IS NULL) AND r."RequiredAssociate_OptionalNestedAssociate_Id" IS NOT NULL) OR ((r."RequiredAssociate_OptionalNestedAssociate_Int" <> r."RequiredAssociate_OptionalNestedAssociate_Int" OR r."RequiredAssociate_OptionalNestedAssociate_Int" IS NULL) AND r."RequiredAssociate_OptionalNestedAssociate_Int" IS NOT NULL) OR ((r."RequiredAssociate_OptionalNestedAssociate_Ints" <> r."RequiredAssociate_OptionalNestedAssociate_Ints" OR r."RequiredAssociate_OptionalNestedAssociate_Ints" IS NULL) AND r."RequiredAssociate_OptionalNestedAssociate_Ints" IS NOT NULL) OR ((r."RequiredAssociate_OptionalNestedAssociate_Name" <> r."RequiredAssociate_OptionalNestedAssociate_Name" OR r."RequiredAssociate_OptionalNestedAssociate_Name" IS NULL) AND r."RequiredAssociate_OptionalNestedAssociate_Name" IS NOT NULL) OR ((r."RequiredAssociate_OptionalNestedAssociate_String" <> r."RequiredAssociate_OptionalNestedAssociate_String" OR r."RequiredAssociate_OptionalNestedAssociate_String" IS NULL) AND r."RequiredAssociate_OptionalNestedAssociate_String" IS NOT NULL) OR r."RequiredAssociate_RequiredNestedAssociate_Id" <> r."RequiredAssociate_RequiredNestedAssociate_Id" OR r."RequiredAssociate_RequiredNestedAssociate_Id" IS NULL OR r."RequiredAssociate_RequiredNestedAssociate_Int" <> r."RequiredAssociate_RequiredNestedAssociate_Int" OR r."RequiredAssociate_RequiredNestedAssociate_Int" IS NULL OR r."RequiredAssociate_RequiredNestedAssociate_Ints" <> r."RequiredAssociate_RequiredNestedAssociate_Ints" OR r."RequiredAssociate_RequiredNestedAssociate_Ints" IS NULL OR r."RequiredAssociate_RequiredNestedAssociate_Name" <> r."RequiredAssociate_RequiredNestedAssociate_Name" OR r."RequiredAssociate_RequiredNestedAssociate_Name" IS NULL OR r."RequiredAssociate_RequiredNestedAssociate_String" <> r."RequiredAssociate_RequiredNestedAssociate_String" OR r."RequiredAssociate_RequiredNestedAssociate_String" IS NULL """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."OptionalRelated_Id" IS NULL +WHERE r."OptionalAssociate_Id" IS NULL """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."OptionalRelated_Id" IS NULL AND r."OptionalRelated_Int" IS NULL AND r."OptionalRelated_Ints" 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_Ints" 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_Ints" IS NULL AND r."OptionalRelated_RequiredNested_Name" IS NULL AND r."OptionalRelated_RequiredNested_String" IS NULL +WHERE r."OptionalAssociate_Id" IS NULL AND r."OptionalAssociate_Int" IS NULL AND r."OptionalAssociate_Ints" IS NULL AND r."OptionalAssociate_Name" IS NULL AND r."OptionalAssociate_String" IS NULL AND r."OptionalAssociate_OptionalNestedAssociate_Id" IS NULL AND r."OptionalAssociate_OptionalNestedAssociate_Int" IS NULL AND r."OptionalAssociate_OptionalNestedAssociate_Ints" IS NULL AND r."OptionalAssociate_OptionalNestedAssociate_Name" IS NULL AND r."OptionalAssociate_OptionalNestedAssociate_String" IS NULL AND r."OptionalAssociate_RequiredNestedAssociate_Id" IS NULL AND r."OptionalAssociate_RequiredNestedAssociate_Int" IS NULL AND r."OptionalAssociate_RequiredNestedAssociate_Ints" IS NULL AND r."OptionalAssociate_RequiredNestedAssociate_Name" IS NULL AND r."OptionalAssociate_RequiredNestedAssociate_String" IS NULL """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_OptionalNested_Id" IS NULL +WHERE r."RequiredAssociate_OptionalNestedAssociate_Id" IS NULL """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r -WHERE r."RequiredRelated_RequiredNested_Id" = 1000 AND r."RequiredRelated_RequiredNested_Int" = 8 AND r."RequiredRelated_RequiredNested_Ints" = ARRAY[1,2,3]::integer[] AND r."RequiredRelated_RequiredNested_Name" = 'Root1_RequiredRelated_RequiredNested' AND r."RequiredRelated_RequiredNested_String" = 'foo' +WHERE r."RequiredAssociate_RequiredNestedAssociate_Id" = 1000 AND r."RequiredAssociate_RequiredNestedAssociate_Int" = 8 AND r."RequiredAssociate_RequiredNestedAssociate_Ints" = ARRAY[1,2,3]::integer[] AND r."RequiredAssociate_RequiredNestedAssociate_Name" = 'Root1_RequiredAssociate_RequiredNestedAssociate' AND r."RequiredAssociate_RequiredNestedAssociate_String" = 'foo' """); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_with_parameter(); AssertSql( """ @@ -104,9 +104,9 @@ public override async Task Nested_with_parameter() @entity_equality_nested_Name='?' @entity_equality_nested_String='?' -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" = @entity_equality_nested_Ints AND r."RequiredRelated_RequiredNested_Name" = @entity_equality_nested_Name AND r."RequiredRelated_RequiredNested_String" = @entity_equality_nested_String +WHERE r."RequiredAssociate_RequiredNestedAssociate_Id" = @entity_equality_nested_Id AND r."RequiredAssociate_RequiredNestedAssociate_Int" = @entity_equality_nested_Int AND r."RequiredAssociate_RequiredNestedAssociate_Ints" = @entity_equality_nested_Ints AND r."RequiredAssociate_RequiredNestedAssociate_Name" = @entity_equality_nested_Name AND r."RequiredAssociate_RequiredNestedAssociate_String" = @entity_equality_nested_String """); } @@ -171,9 +171,9 @@ public override async Task Nullable_value_type_with_null() AssertSql( """ -SELECT v."Id", v."Name", v."OptionalRelated_Id", v."OptionalRelated_Int", v."OptionalRelated_Name", v."OptionalRelated_String", v."OptionalRelated_OptionalNested_Id", v."OptionalRelated_OptionalNested_Int", v."OptionalRelated_OptionalNested_Name", v."OptionalRelated_OptionalNested_String", v."OptionalRelated_RequiredNested_Id", v."OptionalRelated_RequiredNested_Int", v."OptionalRelated_RequiredNested_Name", v."OptionalRelated_RequiredNested_String", v."RequiredRelated_Id", v."RequiredRelated_Int", v."RequiredRelated_Name", v."RequiredRelated_String", v."RequiredRelated_OptionalNested_Id", v."RequiredRelated_OptionalNested_Int", v."RequiredRelated_OptionalNested_Name", v."RequiredRelated_OptionalNested_String", v."RequiredRelated_RequiredNested_Id", v."RequiredRelated_RequiredNested_Int", v."RequiredRelated_RequiredNested_Name", v."RequiredRelated_RequiredNested_String" +SELECT v."Id", v."Name", v."OptionalAssociate_Id", v."OptionalAssociate_Int", v."OptionalAssociate_Name", v."OptionalAssociate_String", v."OptionalAssociate_OptionalNested_Id", v."OptionalAssociate_OptionalNested_Int", v."OptionalAssociate_OptionalNested_Name", v."OptionalAssociate_OptionalNested_String", v."OptionalAssociate_RequiredNested_Id", v."OptionalAssociate_RequiredNested_Int", v."OptionalAssociate_RequiredNested_Name", v."OptionalAssociate_RequiredNested_String", v."RequiredAssociate_Id", v."RequiredAssociate_Int", v."RequiredAssociate_Name", v."RequiredAssociate_String", v."RequiredAssociate_OptionalNested_Id", v."RequiredAssociate_OptionalNested_Int", v."RequiredAssociate_OptionalNested_Name", v."RequiredAssociate_OptionalNested_String", v."RequiredAssociate_RequiredNested_Id", v."RequiredAssociate_RequiredNested_Int", v."RequiredAssociate_RequiredNested_Name", v."RequiredAssociate_RequiredNested_String" FROM "ValueRootEntity" AS v -WHERE v."OptionalRelated_Id" IS NULL +WHERE v."OptionalAssociate_Id" IS NULL """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs index 56c6c8a93..923a99ff1 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionNpgsqlTest.cs @@ -12,28 +12,28 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a0."Id", n."Id", n0."Id", a1."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a1 ON r."RequiredAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a1."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a1."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n3 ON a2."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a2."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a2."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" 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 + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId") = 2 +ORDER BY r."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -43,28 +43,28 @@ public override async Task Where() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a0."Id", n."Id", n0."Id", a1."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a1 ON r."RequiredAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a1."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a1."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n3 ON a2."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a2."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a2."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" 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 + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" AND a."Int" <> 8) = 2 +ORDER BY r."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -74,30 +74,30 @@ public override async Task OrderBy_ElementAt() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a0."Id", n."Id", n0."Id", a1."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a1 ON r."RequiredAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a1."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a1."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n3 ON a2."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a2."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a2."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" WHERE ( - SELECT r0."Int" - FROM "RelatedType" AS r0 - WHERE r."Id" = r0."CollectionRootId" - ORDER BY r0."Id" NULLS FIRST + SELECT a."Int" + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" + ORDER BY a."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 +ORDER BY r."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -109,31 +109,31 @@ public override async Task Distinct() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r3."CollectionRootId", r3."Int", r3."Ints", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a1."Id", n."Id", n0."Id", a2."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a1 ON r."OptionalAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n ON a1."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a1."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a2 ON r."RequiredAssociateId" = a2."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a2."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a2."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r4."Id", r4."CollectionRootId", r4."Int", r4."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a3."Id", a3."CollectionRootId", a3."Int", a3."Ints", a3."Name", a3."OptionalNestedAssociateId", a3."RequiredNestedAssociateId", a3."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a3 + LEFT JOIN "NestedAssociateType" AS n3 ON a3."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a3."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a3."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r3."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a1."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a2."Id" = n7."CollectionAssociateId" WHERE ( SELECT count(*)::int FROM ( - SELECT DISTINCT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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 + SELECT DISTINCT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String" + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" + ) AS a0) = 2 +ORDER BY r."Id" NULLS FIRST, a1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -143,18 +143,18 @@ public override async Task Distinct_projected(QueryTrackingBehavior queryTrackin AssertSql( """ -SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2" +SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints" AS "Ints0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionRelatedId" AS "CollectionRelatedId0", n."Int" AS "Int1", n."Ints" AS "Ints1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionRelatedId" AS "CollectionRelatedId1", n0."Int" AS "Int2", n0."Ints" AS "Ints2", n0."Name" AS "Name2", n0."String" AS "String2" + SELECT a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n."Id" AS "Id0", n0."Id" AS "Id1", n1."Id" AS "Id2", n1."CollectionAssociateId", n1."Int" AS "Int0", n1."Ints" AS "Ints0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionAssociateId" AS "CollectionAssociateId0", n."Int" AS "Int1", n."Ints" AS "Ints1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionAssociateId" AS "CollectionAssociateId1", n0."Int" AS "Int2", n0."Ints" AS "Ints2", n0."Name" AS "Name2", n0."String" AS "String2" FROM ( - SELECT DISTINCT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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" + SELECT DISTINCT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String" + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" + ) AS a0 + LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" + INNER JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" + LEFT JOIN "NestedAssociateType" AS n1 ON a0."Id" = n1."CollectionAssociateId" ) AS s ON TRUE ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST """); @@ -217,30 +217,30 @@ public override async Task GroupBy() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a0."Id", n."Id", n0."Id", a1."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a1 ON r."RequiredAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a1."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a1."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n3 ON a2."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a2."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a2."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" WHERE 16 IN ( - SELECT COALESCE(sum(r0."Int"), 0)::int - FROM "RelatedType" AS r0 - WHERE r."Id" = r0."CollectionRootId" - GROUP BY r0."String" + SELECT COALESCE(sum(a."Int"), 0)::int + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" + GROUP BY a."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 +ORDER BY r."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -255,10 +255,10 @@ public override async Task Select_within_Select_within_Select_with_aggregates() 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 "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId")), 0)::int + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId") FROM "RootEntity" AS r """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeNpgsqlTest.cs index e0af4c313..07bfae14a 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeNpgsqlTest.cs @@ -12,24 +12,24 @@ public override async Task Include_required(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -39,24 +39,24 @@ public override async Task Include_optional(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -66,24 +66,24 @@ public override async Task Include_collection(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -93,24 +93,24 @@ public override async Task Include_required_optional_and_collection(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -120,24 +120,24 @@ public override async Task Include_nested(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -147,24 +147,24 @@ public override async Task Include_nested_optional(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -174,24 +174,24 @@ public override async Task Include_nested_collection(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -201,24 +201,24 @@ public override async Task Include_nested_collection_on_optional(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -228,24 +228,24 @@ public override async Task Include_nested_collection_on_collection(bool async) AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousNpgsqlTest.cs index 07d196ff0..e0de33289 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousNpgsqlTest.cs @@ -10,87 +10,87 @@ public class NavigationsMiscellaneousNpgsqlTest( { #region Simple filters - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE a."Int" = 8 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +WHERE a."Int" = 8 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionNpgsqlTest.cs index da2bbf9b2..0421865be 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionNpgsqlTest.cs @@ -9,25 +9,25 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" -WHERE cardinality(r0."Ints") = 3 -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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE cardinality(a."Ints") = 3 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -37,25 +37,25 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" -WHERE r0."Ints"[1] = 1 -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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE a."Ints"[1] = 1 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -65,25 +65,25 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" -WHERE 3 = ANY (r0."Ints") -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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE 3 = ANY (a."Ints") +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -93,25 +93,25 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" -WHERE 2 = ANY (r0."Ints") -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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE 2 = ANY (a."Ints") +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -121,25 +121,25 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" WHERE cardinality(n."Ints") = 3 -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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -151,12 +151,12 @@ public override async Task Select_Sum() """ SELECT ( SELECT COALESCE(sum(i0.value), 0)::int - FROM unnest(r0."Ints") AS i0(value)) + FROM unnest(a."Ints") AS i0(value)) FROM "RootEntity" AS r -INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" WHERE ( SELECT COALESCE(sum(i.value), 0)::int - FROM unnest(r0."Ints") AS i(value)) >= 6 + FROM unnest(a."Ints") AS i(value)) >= 6 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionNpgsqlTest.cs index 9599d5148..c3252acd0 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionNpgsqlTest.cs @@ -12,276 +12,304 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - #region Simple properties + #region Scalar properties - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r0."String" +SELECT a."String" FROM "RootEntity" AS r -INNER JOIN "RelatedType" AS r0 ON r."RequiredRelatedId" = r0."Id" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r0."String" +SELECT a."String" FROM "RootEntity" AS r -LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ -SELECT r0."Int" +SELECT a."Int" FROM "RootEntity" AS r -LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ -SELECT r0."Int" +SELECT a."Int" FROM "RootEntity" AS r -LEFT JOIN "RelatedType" AS r0 ON r."OptionalRelatedId" = r0."Id" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" """); } - #endregion Simple properties + #endregion Scalar properties - #region Non-collection + #region Structural properties - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); AssertSql( """ -SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String" +SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", 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 +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +INNER JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String" +SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", 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 +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" """); } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" """); } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" """); } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" """); } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); AssertSql( """ -SELECT r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r."Id", r0."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String" +SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", r."Id", r0."Id", n."Id", n0."Id", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", 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 +LEFT JOIN "AssociateType" AS a ON r0."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - #endregion Non-collection + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String" +FROM "RootEntity" AS r +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +INNER JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST +"""); + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT a."Int" +FROM "RootEntity" AS r +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +"""); + } + + #endregion Structural properties - #region Collection + #region Structural collection properties - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2" +SELECT r."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2" FROM "RootEntity" AS r LEFT JOIN ( - SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints" AS "Ints0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionRelatedId" AS "CollectionRelatedId0", n."Int" AS "Int1", n."Ints" AS "Ints1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionRelatedId" AS "CollectionRelatedId1", n0."Int" AS "Int2", n0."Ints" AS "Ints2", 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" + SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n."Id" AS "Id0", n0."Id" AS "Id1", n1."Id" AS "Id2", n1."CollectionAssociateId", n1."Int" AS "Int0", n1."Ints" AS "Ints0", n1."Name" AS "Name0", n1."String" AS "String0", n."CollectionAssociateId" AS "CollectionAssociateId0", n."Int" AS "Int1", n."Ints" AS "Ints1", n."Name" AS "Name1", n."String" AS "String1", n0."CollectionAssociateId" AS "CollectionAssociateId1", n0."Int" AS "Int2", n0."Ints" AS "Ints2", n0."Name" AS "Name2", n0."String" AS "String2" + FROM "AssociateType" AS a + LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" + INNER JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" + LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" ) 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_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r0."Id", n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", a."Id", n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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 +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."Id" = n."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST """); } - public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."Id", r0."Id", n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", a."Id", n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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 +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."Id" = n."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST """); } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); AssertSql( """ -SELECT r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String" +SELECT a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", r."Id", n."Id", n0."Id", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", 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 +INNER JOIN "AssociateType" AS a ON r."Id" = a."CollectionRootId" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +INNER JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."Id" = n1."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST """); } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."Id" = n."CollectionAssociateId" """); } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" +LEFT JOIN "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."Id" = n."CollectionAssociateId" """); } - #endregion Collection + #endregion Structural collection properties #region Multiple @@ -291,33 +319,33 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n8."Id", n8."CollectionRelatedId", n8."Int", n8."Ints", n8."Name", n8."String", s0."Id", s0."CollectionRootId", s0."Int", s0."Ints", s0."Name", s0."OptionalNestedId", s0."RequiredNestedId", s0."String", s0."Id0", s0."Id1", s0."Id2", s0."CollectionRelatedId", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."CollectionRelatedId0", s0."Int1", s0."Ints1", s0."Name1", s0."String1", s0."CollectionRelatedId1", s0."Int2", s0."Ints2", s0."Name2", s0."String2", n12."Id", n12."CollectionRelatedId", n12."Int", n12."Ints", n12."Name", n12."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", s0."Id", s0."CollectionRootId", s0."Int", s0."Ints", s0."Name", s0."OptionalNestedAssociateId", s0."RequiredNestedAssociateId", s0."String", s0."Id0", s0."Id1", s0."Id2", s0."CollectionAssociateId", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."CollectionAssociateId0", s0."Int1", s0."Ints1", s0."Name1", s0."String1", s0."CollectionAssociateId1", s0."Int2", s0."Ints2", s0."Name2", s0."String2", n11."Id", n11."CollectionAssociateId", n11."Int", n11."Ints", n11."Name", n11."String", n12."Id", n12."CollectionAssociateId", n12."Int", n12."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n11."Name" AS "Name0", n11."String" AS "String0", n9."CollectionRelatedId" AS "CollectionRelatedId0", n9."Int" AS "Int1", n9."Ints" AS "Ints1", n9."Name" AS "Name1", n9."String" AS "String1", n10."CollectionRelatedId" AS "CollectionRelatedId1", n10."Int" AS "Int2", n10."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n8."Id" AS "Id0", n9."Id" AS "Id1", n10."Id" AS "Id2", n10."CollectionAssociateId", n10."Int" AS "Int0", n10."Ints" AS "Ints0", n10."Name" AS "Name0", n10."String" AS "String0", n8."CollectionAssociateId" AS "CollectionAssociateId0", n8."Int" AS "Int1", n8."Ints" AS "Ints1", n8."Name" AS "Name1", n8."String" AS "String1", n9."CollectionAssociateId" AS "CollectionAssociateId1", n9."Int" AS "Int2", n9."Ints" AS "Ints2", n9."Name" AS "Name2", n9."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n8 ON a2."OptionalNestedAssociateId" = n8."Id" + INNER JOIN "NestedAssociateType" AS n9 ON a2."RequiredNestedAssociateId" = n9."Id" + LEFT JOIN "NestedAssociateType" AS n10 ON a2."Id" = n10."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n11 ON a."Id" = n11."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n12 ON a0."Id" = n12."CollectionAssociateId" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST, n7."Id" NULLS FIRST, s0."Id" NULLS FIRST, s0."Id0" NULLS FIRST, s0."Id1" NULLS FIRST, s0."Id2" NULLS FIRST, n11."Id" NULLS FIRST """); } @@ -331,13 +359,13 @@ public override async Task Select_subquery_required_related_FirstOrDefault(Query AssertSql( """ -SELECT s."Id", s."CollectionRelatedId", s."Int", s."Ints", s."Name", s."String" +SELECT s."Id", s."CollectionAssociateId", s."Int", s."Ints", s."Name", s."String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" + SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" + INNER JOIN "AssociateType" AS a ON r0."RequiredAssociateId" = a."Id" + INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" ORDER BY r0."Id" NULLS FIRST LIMIT 1 ) AS s ON TRUE @@ -350,13 +378,13 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query AssertSql( """ -SELECT s."Id", s."CollectionRelatedId", s."Int", s."Ints", s."Name", s."String" +SELECT s."Id", s."CollectionAssociateId", s."Int", s."Ints", s."Name", s."String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT n."Id", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" + SELECT n."Id", n."CollectionAssociateId", n."Int", n."Ints", 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" + LEFT JOIN "AssociateType" AS a ON r0."OptionalAssociateId" = a."Id" + LEFT JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" ORDER BY r0."Id" NULLS FIRST LIMIT 1 ) AS s ON TRUE diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsNpgsqlTest.cs index f9be05387..0801f4860 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsNpgsqlTest.cs @@ -8,110 +8,110 @@ public class NavigationsSetOperationsNpgsqlTest( ITestOutputHelper testOutputHelper) : NavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) { - public override async Task On_related() + public override async Task Over_associate_collections() { - await base.On_related(); + await base.Over_associate_collections(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r3."CollectionRootId", r3."Int", r3."Ints", r3."Name", r3."OptionalNestedId", r3."RequiredNestedId", r3."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a1."Id", n."Id", n0."Id", a2."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a1 ON r."OptionalAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n ON a1."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a1."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a2 ON r."RequiredAssociateId" = a2."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a2."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a2."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r4."Id", r4."CollectionRootId", r4."Int", r4."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a3."Id", a3."CollectionRootId", a3."Int", a3."Ints", a3."Name", a3."OptionalNestedAssociateId", a3."RequiredNestedAssociateId", a3."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a3 + LEFT JOIN "NestedAssociateType" AS n3 ON a3."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a3."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a3."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r3."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a1."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a2."Id" = n7."CollectionAssociateId" WHERE ( SELECT count(*)::int FROM ( SELECT 1 - FROM "RelatedType" AS r0 - WHERE r."Id" = r0."CollectionRootId" AND r0."Int" = 8 + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" AND a."Int" = 8 UNION ALL SELECT 1 - FROM "RelatedType" AS r1 - WHERE r."Id" = r1."CollectionRootId" AND r1."String" = 'foo' + FROM "AssociateType" AS a0 + WHERE r."Id" = a0."CollectionRootId" AND a0."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 +ORDER BY r."Id" NULLS FIRST, a1."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a2."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) { - await base.On_related_projected(queryTrackingBehavior); + await base.Over_associate_collection_projected(queryTrackingBehavior); AssertSql(); } - public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) { - await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(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 "NestedAssociateType" AS n + WHERE u."Id" = n."CollectionAssociateId")), 0)::int FROM ( - SELECT r0."Id" - FROM "RelatedType" AS r0 - WHERE r."Id" = r0."CollectionRootId" AND r0."Int" = 8 + SELECT a."Id" + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" AND a."Int" = 8 UNION ALL - SELECT r1."Id" - FROM "RelatedType" AS r1 - WHERE r."Id" = r1."CollectionRootId" AND r1."String" = 'foo' + SELECT a0."Id" + FROM "AssociateType" AS a0 + WHERE r."Id" = a0."CollectionRootId" AND a0."String" = 'foo' ) AS u) FROM "RootEntity" AS r """); } - public override async Task On_nested() + public override async Task Over_nested_associate_collection() { - await base.On_nested(); + await base.Over_nested_associate_collection(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n5."Name", n5."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n9."Id", n9."CollectionRelatedId", n9."Int", n9."Ints", n9."Name", n9."String", n3."CollectionRelatedId", n3."Int", n3."Ints", n3."Name", n3."String", n4."CollectionRelatedId", n4."Int", n4."Ints", n4."Name", n4."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n1."Id", n2."Id", n3."Id", n4."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n8."Id", n8."CollectionAssociateId", n8."Int", n8."Ints", n8."Name", n8."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n9."Id", n9."CollectionAssociateId", n9."Int", n9."Ints", n9."Name", n9."String", n3."CollectionAssociateId", n3."Int", n3."Ints", n3."Name", n3."String", n4."CollectionAssociateId", n4."Int", n4."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" +LEFT JOIN "NestedAssociateType" AS n3 ON a."OptionalNestedAssociateId" = n3."Id" +INNER JOIN "NestedAssociateType" AS n4 ON a."RequiredNestedAssociateId" = n4."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n8."Name" AS "Name0", n8."String" AS "String0", n6."CollectionRelatedId" AS "CollectionRelatedId0", n6."Int" AS "Int1", n6."Ints" AS "Ints1", n6."Name" AS "Name1", n6."String" AS "String1", n7."CollectionRelatedId" AS "CollectionRelatedId1", n7."Int" AS "Int2", n7."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n6."Id" AS "Id1", n7."Id" AS "Id2", n7."CollectionAssociateId", n7."Int" AS "Int0", n7."Ints" AS "Ints0", n7."Name" AS "Name0", n7."String" AS "String0", n5."CollectionAssociateId" AS "CollectionAssociateId0", n5."Int" AS "Int1", n5."Ints" AS "Ints1", n5."Name" AS "Name1", n5."String" AS "String1", n6."CollectionAssociateId" AS "CollectionAssociateId1", n6."Int" AS "Int2", n6."Ints" AS "Ints2", n6."Name" AS "Name2", n6."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n5 ON a1."OptionalNestedAssociateId" = n5."Id" + INNER JOIN "NestedAssociateType" AS n6 ON a1."RequiredNestedAssociateId" = n6."Id" + LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n9 ON r0."Id" = n9."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n8 ON a0."Id" = n8."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n9 ON a."Id" = n9."CollectionAssociateId" WHERE ( SELECT count(*)::int FROM ( SELECT 1 - FROM "NestedType" AS n - WHERE r0."Id" = n."CollectionRelatedId" AND n."Int" = 8 + FROM "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId" AND n."Int" = 8 UNION ALL SELECT 1 - FROM "NestedType" AS n0 - WHERE r0."Id" = n0."CollectionRelatedId" AND n0."String" = 'foo' + FROM "NestedAssociateType" AS n0 + WHERE a."Id" = n0."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n8."Id" NULLS FIRST """); } @@ -121,35 +121,35 @@ public override async Task Over_different_collection_properties() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n5."Name", n5."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n9."Id", n9."CollectionRelatedId", n9."Int", n9."Ints", n9."Name", n9."String", n3."CollectionRelatedId", n3."Int", n3."Ints", n3."Name", n3."String", n4."CollectionRelatedId", n4."Int", n4."Ints", n4."Name", n4."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n1."Id", n2."Id", n3."Id", n4."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n8."Id", n8."CollectionAssociateId", n8."Int", n8."Ints", n8."Name", n8."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n9."Id", n9."CollectionAssociateId", n9."Int", n9."Ints", n9."Name", n9."String", n3."CollectionAssociateId", n3."Int", n3."Ints", n3."Name", n3."String", n4."CollectionAssociateId", n4."Int", n4."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" +LEFT JOIN "NestedAssociateType" AS n3 ON a."OptionalNestedAssociateId" = n3."Id" +INNER JOIN "NestedAssociateType" AS n4 ON a."RequiredNestedAssociateId" = n4."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n8."Name" AS "Name0", n8."String" AS "String0", n6."CollectionRelatedId" AS "CollectionRelatedId0", n6."Int" AS "Int1", n6."Ints" AS "Ints1", n6."Name" AS "Name1", n6."String" AS "String1", n7."CollectionRelatedId" AS "CollectionRelatedId1", n7."Int" AS "Int2", n7."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n6."Id" AS "Id1", n7."Id" AS "Id2", n7."CollectionAssociateId", n7."Int" AS "Int0", n7."Ints" AS "Ints0", n7."Name" AS "Name0", n7."String" AS "String0", n5."CollectionAssociateId" AS "CollectionAssociateId0", n5."Int" AS "Int1", n5."Ints" AS "Ints1", n5."Name" AS "Name1", n5."String" AS "String1", n6."CollectionAssociateId" AS "CollectionAssociateId1", n6."Int" AS "Int2", n6."Ints" AS "Ints2", n6."Name" AS "Name2", n6."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n5 ON a1."OptionalNestedAssociateId" = n5."Id" + INNER JOIN "NestedAssociateType" AS n6 ON a1."RequiredNestedAssociateId" = n6."Id" + LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n9 ON r0."Id" = n9."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n8 ON a0."Id" = n8."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n9 ON a."Id" = n9."CollectionAssociateId" WHERE ( SELECT count(*)::int FROM ( SELECT 1 - FROM "NestedType" AS n - WHERE r0."Id" = n."CollectionRelatedId" + FROM "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId" UNION ALL SELECT 1 - FROM "NestedType" AS n0 - WHERE r1."Id" IS NOT NULL AND r1."Id" = n0."CollectionRelatedId" + FROM "NestedAssociateType" AS n0 + WHERE a0."Id" IS NOT NULL AND a0."Id" = n0."CollectionAssociateId" ) 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n8."Id" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs index 415e3616d..54f933630 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityNpgsqlTest.cs @@ -8,59 +8,59 @@ public class NavigationsStructuralEqualityNpgsqlTest( ITestOutputHelper testOutputHelper) : NavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) { - public override async Task Two_related() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE a."Id" = a0."Id" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -70,167 +70,167 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE a."Id" <> a0."Id" OR a0."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +WHERE a."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r0."Id", r0."CollectionRootId", r0."Int", r0."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", n0."Id", a0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a ON r."OptionalAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a0 ON r."RequiredAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a0."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +WHERE a."Id" IS NULL +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "NestedAssociateType" AS n ON a."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_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."Ints", 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."Ints", n3."Name", n3."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", n."Id", a0."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."CollectionAssociateId", n."Int", n."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r0."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" 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 +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, n."Id" NULLS FIRST, a0."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -240,25 +240,25 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n."Id", n0."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId" ) 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 +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId" +WHERE a."Id" = a0."Id" +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } @@ -284,28 +284,28 @@ public override async Task Contains_with_inline() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n0."Id", n1."Id", n2."Id", n3."Id", n4."Id", n4."CollectionRelatedId", n4."Int", n4."Ints", n4."Name", n4."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n8."Id", n8."CollectionRelatedId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionRelatedId", n3."Int", n3."Ints", n3."Name", n3."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n0."Id", n1."Id", n2."Id", n3."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n8."Id", n8."CollectionAssociateId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionAssociateId", n3."Int", n3."Ints", n3."Name", n3."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 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" -INNER JOIN "NestedType" AS n3 ON r0."RequiredNestedId" = n3."Id" -LEFT JOIN "NestedType" AS n4 ON r1."Id" = n4."CollectionRelatedId" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" +INNER JOIN "NestedAssociateType" AS n3 ON a."RequiredNestedAssociateId" = n3."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n5."Id" AS "Id0", n6."Id" AS "Id1", n7."Id" AS "Id2", n7."CollectionRelatedId", n7."Int" AS "Int0", n7."Ints" AS "Ints0", n7."Name" AS "Name0", n7."String" AS "String0", n5."CollectionRelatedId" AS "CollectionRelatedId0", n5."Int" AS "Int1", n5."Ints" AS "Ints1", n5."Name" AS "Name1", n5."String" AS "String1", n6."CollectionRelatedId" AS "CollectionRelatedId1", n6."Int" AS "Int2", n6."Ints" AS "Ints2", n6."Name" AS "Name2", n6."String" AS "String2" - FROM "RelatedType" AS r2 - LEFT JOIN "NestedType" AS n5 ON r2."OptionalNestedId" = n5."Id" - INNER JOIN "NestedType" AS n6 ON r2."RequiredNestedId" = n6."Id" - LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionAssociateId", n6."Int" AS "Int0", n6."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionAssociateId" AS "CollectionAssociateId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionAssociateId" AS "CollectionAssociateId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n4 ON a1."OptionalNestedAssociateId" = n4."Id" + INNER JOIN "NestedAssociateType" AS n5 ON a1."RequiredNestedAssociateId" = n5."Id" + LEFT JOIN "NestedAssociateType" AS n6 ON a1."Id" = n6."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n8 ON r0."Id" = n8."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n8 ON a."Id" = n8."CollectionAssociateId" WHERE EXISTS ( SELECT 1 - FROM "NestedType" AS n - WHERE r0."Id" = n."CollectionRelatedId" AND n."Id" = 1002) -ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST + FROM "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId" AND n."Id" = 1002) +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."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, n7."Id" NULLS FIRST """); } @@ -317,28 +317,28 @@ public override async Task Contains_with_parameter() """ @entity_equality_nested_Id='1002' (Nullable = true) -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n0."Id", n1."Id", n2."Id", n3."Id", n4."Id", n4."CollectionRelatedId", n4."Int", n4."Ints", n4."Name", n4."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n8."Id", n8."CollectionRelatedId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionRelatedId", n3."Int", n3."Ints", n3."Name", n3."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n0."Id", n1."Id", n2."Id", n3."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n8."Id", n8."CollectionAssociateId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionAssociateId", n3."Int", n3."Ints", n3."Name", n3."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 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" -INNER JOIN "NestedType" AS n3 ON r0."RequiredNestedId" = n3."Id" -LEFT JOIN "NestedType" AS n4 ON r1."Id" = n4."CollectionRelatedId" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" +INNER JOIN "NestedAssociateType" AS n3 ON a."RequiredNestedAssociateId" = n3."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n5."Id" AS "Id0", n6."Id" AS "Id1", n7."Id" AS "Id2", n7."CollectionRelatedId", n7."Int" AS "Int0", n7."Ints" AS "Ints0", n7."Name" AS "Name0", n7."String" AS "String0", n5."CollectionRelatedId" AS "CollectionRelatedId0", n5."Int" AS "Int1", n5."Ints" AS "Ints1", n5."Name" AS "Name1", n5."String" AS "String1", n6."CollectionRelatedId" AS "CollectionRelatedId1", n6."Int" AS "Int2", n6."Ints" AS "Ints2", n6."Name" AS "Name2", n6."String" AS "String2" - FROM "RelatedType" AS r2 - LEFT JOIN "NestedType" AS n5 ON r2."OptionalNestedId" = n5."Id" - INNER JOIN "NestedType" AS n6 ON r2."RequiredNestedId" = n6."Id" - LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionAssociateId", n6."Int" AS "Int0", n6."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionAssociateId" AS "CollectionAssociateId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionAssociateId" AS "CollectionAssociateId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n4 ON a1."OptionalNestedAssociateId" = n4."Id" + INNER JOIN "NestedAssociateType" AS n5 ON a1."RequiredNestedAssociateId" = n5."Id" + LEFT JOIN "NestedAssociateType" AS n6 ON a1."Id" = n6."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n8 ON r0."Id" = n8."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n8 ON a."Id" = n8."CollectionAssociateId" WHERE EXISTS ( SELECT 1 - FROM "NestedType" AS n - WHERE r0."Id" = n."CollectionRelatedId" AND n."Id" = @entity_equality_nested_Id) -ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST + FROM "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId" AND n."Id" = @entity_equality_nested_Id) +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."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, n7."Id" NULLS FIRST """); } @@ -351,28 +351,28 @@ public override async Task Contains_with_operators_composed_on_the_collection() @get_Item_Int='106' @entity_equality_get_Item_Id='3003' (Nullable = true) -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", r1."Name", r1."OptionalNestedId", r1."RequiredNestedId", r1."String", r0."Id", n0."Id", n1."Id", n2."Id", n3."Id", n4."Id", n4."CollectionRelatedId", n4."Int", n4."Ints", n4."Name", n4."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r0."CollectionRootId", r0."Int", r0."Ints", r0."Name", r0."OptionalNestedId", r0."RequiredNestedId", r0."String", n8."Id", n8."CollectionRelatedId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionRelatedId", n3."Int", n3."Ints", n3."Name", n3."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a."Id", a0."Id", n0."Id", n1."Id", n2."Id", n3."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n8."Id", n8."CollectionAssociateId", n8."Int", n8."Ints", n8."Name", n8."String", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n3."CollectionAssociateId", n3."Int", n3."Ints", n3."Name", n3."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 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" -INNER JOIN "NestedType" AS n3 ON r0."RequiredNestedId" = n3."Id" -LEFT JOIN "NestedType" AS n4 ON r1."Id" = n4."CollectionRelatedId" +INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id" +LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id" +LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id" +INNER JOIN "NestedAssociateType" AS n3 ON a."RequiredNestedAssociateId" = n3."Id" LEFT JOIN ( - SELECT r2."Id", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n5."Id" AS "Id0", n6."Id" AS "Id1", n7."Id" AS "Id2", n7."CollectionRelatedId", n7."Int" AS "Int0", n7."Ints" AS "Ints0", n7."Name" AS "Name0", n7."String" AS "String0", n5."CollectionRelatedId" AS "CollectionRelatedId0", n5."Int" AS "Int1", n5."Ints" AS "Ints1", n5."Name" AS "Name1", n5."String" AS "String1", n6."CollectionRelatedId" AS "CollectionRelatedId1", n6."Int" AS "Int2", n6."Ints" AS "Ints2", n6."Name" AS "Name2", n6."String" AS "String2" - FROM "RelatedType" AS r2 - LEFT JOIN "NestedType" AS n5 ON r2."OptionalNestedId" = n5."Id" - INNER JOIN "NestedType" AS n6 ON r2."RequiredNestedId" = n6."Id" - LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" + SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n4."Id" AS "Id0", n5."Id" AS "Id1", n6."Id" AS "Id2", n6."CollectionAssociateId", n6."Int" AS "Int0", n6."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionAssociateId" AS "CollectionAssociateId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionAssociateId" AS "CollectionAssociateId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", n5."Name" AS "Name2", n5."String" AS "String2" + FROM "AssociateType" AS a1 + LEFT JOIN "NestedAssociateType" AS n4 ON a1."OptionalNestedAssociateId" = n4."Id" + INNER JOIN "NestedAssociateType" AS n5 ON a1."RequiredNestedAssociateId" = n5."Id" + LEFT JOIN "NestedAssociateType" AS n6 ON a1."Id" = n6."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n8 ON r0."Id" = n8."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n7 ON a0."Id" = n7."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n8 ON a."Id" = n8."CollectionAssociateId" WHERE EXISTS ( SELECT 1 - FROM "NestedType" AS n - WHERE r0."Id" = n."CollectionRelatedId" AND n."Int" > @get_Item_Int AND n."Id" = @entity_equality_get_Item_Id) -ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."Id" NULLS FIRST, n0."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, n3."Id" NULLS FIRST, n4."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST + FROM "NestedAssociateType" AS n + WHERE a."Id" = n."CollectionAssociateId" AND n."Int" > @get_Item_Int AND n."Id" = @entity_equality_get_Item_Id) +ORDER BY r."Id" NULLS FIRST, a."Id" NULLS FIRST, a0."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, n7."Id" NULLS FIRST """); } @@ -385,28 +385,28 @@ public override async Task Contains_with_nested_and_composed_operators() @get_Item_Id='302' @entity_equality_get_Item_Id='303' (Nullable = true) -SELECT r."Id", r."Name", r."OptionalRelatedId", r."RequiredRelatedId", r1."Id", r1."CollectionRootId", r1."Int", r1."Ints", 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."Ints", n3."Name", n3."String", n."CollectionRelatedId", n."Int", n."Ints", n."Name", n."String", n0."CollectionRelatedId", n0."Int", n0."Ints", n0."Name", n0."String", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedId", s."RequiredNestedId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionRelatedId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionRelatedId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionRelatedId1", s."Int2", s."Ints2", s."Name2", s."String2", r2."CollectionRootId", r2."Int", r2."Ints", r2."Name", r2."OptionalNestedId", r2."RequiredNestedId", r2."String", n7."Id", n7."CollectionRelatedId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionRelatedId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionRelatedId", n2."Int", n2."Ints", n2."Name", n2."String" +SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", a0."Id", n."Id", n0."Id", a1."Id", n1."Id", n2."Id", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."Id1", s."Id2", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."CollectionAssociateId", n2."Int", n2."Ints", 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 "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id" +LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id" +LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id" +INNER JOIN "AssociateType" AS a1 ON r."RequiredAssociateId" = a1."Id" +LEFT JOIN "NestedAssociateType" AS n1 ON a1."OptionalNestedAssociateId" = n1."Id" +INNER JOIN "NestedAssociateType" AS n2 ON a1."RequiredNestedAssociateId" = n2."Id" LEFT JOIN ( - SELECT r3."Id", r3."CollectionRootId", r3."Int", r3."Ints", 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."Ints" AS "Ints0", n6."Name" AS "Name0", n6."String" AS "String0", n4."CollectionRelatedId" AS "CollectionRelatedId0", n4."Int" AS "Int1", n4."Ints" AS "Ints1", n4."Name" AS "Name1", n4."String" AS "String1", n5."CollectionRelatedId" AS "CollectionRelatedId1", n5."Int" AS "Int2", n5."Ints" AS "Ints2", 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" + SELECT a2."Id", a2."CollectionRootId", a2."Int", a2."Ints", a2."Name", a2."OptionalNestedAssociateId", a2."RequiredNestedAssociateId", a2."String", n3."Id" AS "Id0", n4."Id" AS "Id1", n5."Id" AS "Id2", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2" + FROM "AssociateType" AS a2 + LEFT JOIN "NestedAssociateType" AS n3 ON a2."OptionalNestedAssociateId" = n3."Id" + INNER JOIN "NestedAssociateType" AS n4 ON a2."RequiredNestedAssociateId" = n4."Id" + LEFT JOIN "NestedAssociateType" AS n5 ON a2."Id" = n5."CollectionAssociateId" ) AS s ON r."Id" = s."CollectionRootId" -LEFT JOIN "NestedType" AS n7 ON r2."Id" = n7."CollectionRelatedId" +LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId" +LEFT JOIN "NestedAssociateType" AS n7 ON a1."Id" = n7."CollectionAssociateId" WHERE EXISTS ( SELECT 1 - FROM "RelatedType" AS r0 - WHERE r."Id" = r0."CollectionRootId" AND r0."Id" > @get_Item_Id AND r0."Id" = @entity_equality_get_Item_Id) -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 + FROM "AssociateType" AS a + WHERE r."Id" = a."CollectionRootId" AND a."Id" > @get_Item_Id AND a."Id" = @entity_equality_get_Item_Id) +ORDER BY r."Id" NULLS FIRST, a0."Id" NULLS FIRST, n."Id" NULLS FIRST, n0."Id" NULLS FIRST, a1."Id" NULLS FIRST, n1."Id" NULLS FIRST, n2."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, s."Id1" NULLS FIRST, s."Id2" NULLS FIRST, n6."Id" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs index a5248fee6..e062849bf 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionNpgsqlTest.cs @@ -12,20 +12,20 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( SELECT count(*)::int - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb - )) WITH ORDINALITY AS r0) = 2 + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a) = 2 """); } @@ -35,18 +35,18 @@ public override async Task Where() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( SELECT count(*)::int - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text - )) WITH ORDINALITY AS r0 - WHERE r0."Int" <> 8) = 2 + )) WITH ORDINALITY AS a + WHERE a."Int" <> 8) = 2 """); } @@ -56,18 +56,18 @@ public override async Task OrderBy_ElementAt() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( - SELECT r0."Int" - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + SELECT a."Int" + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text - )) WITH ORDINALITY AS r0 - ORDER BY r0."Id" NULLS FIRST + )) WITH ORDINALITY AS a + ORDER BY a."Id" NULLS FIRST LIMIT 1 OFFSET 0) = 8 """); } @@ -80,23 +80,23 @@ public override async Task Distinct() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE ( SELECT count(*)::int FROM ( - SELECT DISTINCT r."Id", r0."Id" AS "Id0", r0."Int", r0."Ints", 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 ( + SELECT DISTINCT r."Id", a."Id" AS "Id0", a."Int", a."Ints", a."Name", a."String", a."NestedCollection" AS c, a."OptionalNestedAssociate" AS c0, a."RequiredNestedAssociate" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb - )) WITH ORDINALITY AS r0 - ) AS r1) = 2 + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a + ) AS a0) = 2 """); } @@ -108,22 +108,22 @@ public override async Task Distinct_projected(QueryTrackingBehavior queryTrackin { AssertSql( """ -SELECT r."Id", r1."Id", r1."Id0", r1."Int", r1."Ints", r1."Name", r1."String", r1.c, r1.c0, r1.c1 +SELECT r."Id", a0."Id", a0."Id0", a0."Int", a0."Ints", a0."Name", a0."String", a0.c, a0.c0, a0.c1 FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT DISTINCT r."Id", r0."Id" AS "Id0", r0."Int", r0."Ints", 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 ( + SELECT DISTINCT r."Id", a."Id" AS "Id0", a."Int", a."Ints", a."Name", a."String", a."NestedCollection" AS c, a."OptionalNestedAssociate" AS c0, a."RequiredNestedAssociate" AS c1 + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "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."Ints" NULLS FIRST, r1."Name" NULLS FIRST + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb + )) WITH ORDINALITY AS a +) AS a0 ON TRUE +ORDER BY r."Id" NULLS FIRST, a0."Id0" NULLS FIRST, a0."Int" NULLS FIRST, a0."Ints" NULLS FIRST, a0."Name" NULLS FIRST """); } } @@ -152,9 +152,9 @@ public override async Task Index_constant() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> '{0,Int}' AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> '{0,Int}' AS integer)) = 8 """); } @@ -166,9 +166,9 @@ public override async Task Index_parameter() """ @i='0' -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> ARRAY[@i,'Int']::text[] AS integer)) = 8 """); } @@ -178,9 +178,9 @@ public override async Task Index_column() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> ARRAY[r."Id" - 1,'Int']::text[] AS integer)) = 8 """); } @@ -190,9 +190,9 @@ public override async Task Index_out_of_bounds() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RelatedCollection" #>> '{9999,Int}' AS integer)) = 8 +WHERE (CAST(r."AssociateCollection" #>> '{9999,Int}' AS integer)) = 8 """); } @@ -207,21 +207,21 @@ public override async Task GroupBy() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE 16 IN ( - SELECT COALESCE(sum(r1."Int"), 0)::int + SELECT COALESCE(sum(a0."Int"), 0)::int FROM ( - SELECT r0."Id" AS "Id0", r0."Int", r0."Ints", r0."Name", r0."String", r0."String" AS "Key" - FROM ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( + SELECT a."Id" AS "Id0", a."Int", a."Ints", a."Name", a."String", a."String" AS "Key" + FROM ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text - )) WITH ORDINALITY AS r0 - ) AS r1 - GROUP BY r1."Key" + )) WITH ORDINALITY AS a + ) AS a0 + GROUP BY a0."Key" ) """); } @@ -237,14 +237,14 @@ public override async Task Select_within_Select_within_Select_with_aggregates() SELECT ( SELECT COALESCE(sum(( SELECT max(n."Int") - FROM ROWS FROM (jsonb_to_recordset(r0."NestedCollection") AS ( + FROM ROWS FROM (jsonb_to_recordset(a."NestedCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "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 ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ("NestedCollection" jsonb)) WITH ORDINALITY AS a) FROM "RootEntity" AS r """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs index 38fde676d..72ba854d4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousNpgsqlTest.cs @@ -10,39 +10,39 @@ public class OwnedJsonMiscellaneousNpgsqlTest( { #region Simple filters - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(r."RequiredAssociate" ->> 'Int' AS integer)) = 8 """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."OptionalRelated" ->> 'Int' AS integer)) = 8 +WHERE (CAST(r."OptionalAssociate" ->> 'Int' AS integer)) = 8 """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" #>> '{RequiredNested,Int}' AS integer)) = 8 +WHERE (CAST(r."RequiredAssociate" #>> '{RequiredNestedAssociate,Int}' AS integer)) = 8 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionNpgsqlTest.cs index 5ebb66d56..1ed4990af 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionNpgsqlTest.cs @@ -9,9 +9,9 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE jsonb_array_length(r."RequiredRelated" -> 'Ints') = 3 +WHERE jsonb_array_length(r."RequiredAssociate" -> 'Ints') = 3 """); } @@ -21,9 +21,9 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (CAST(r."RequiredRelated" #>> '{Ints,0}' AS integer)) = 1 +WHERE (CAST(r."RequiredAssociate" #>> '{Ints,0}' AS integer)) = 1 """); } @@ -33,9 +33,9 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'Ints') @> to_jsonb(3) +WHERE (r."RequiredAssociate" -> 'Ints') @> to_jsonb(3) """); } @@ -45,9 +45,9 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" -> 'Ints') @> to_jsonb(2) +WHERE (r."RequiredAssociate" -> 'Ints') @> to_jsonb(2) """); } @@ -57,9 +57,9 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE jsonb_array_length(r."RequiredRelated" #> '{RequiredNested,Ints}') = 3 +WHERE jsonb_array_length(r."RequiredAssociate" #> '{RequiredNestedAssociate,Ints}') = 3 """); } @@ -71,11 +71,11 @@ public override async Task Select_Sum() """ SELECT ( SELECT COALESCE(sum(i0.element::int), 0)::int - FROM jsonb_array_elements_text(r."RequiredRelated" -> 'Ints') WITH ORDINALITY AS i0(element)) + FROM jsonb_array_elements_text(r."RequiredAssociate" -> 'Ints') WITH ORDINALITY AS i0(element)) FROM "RootEntity" AS r WHERE ( SELECT COALESCE(sum(i.element::int), 0)::int - FROM jsonb_array_elements_text(r."RequiredRelated" -> 'Ints') WITH ORDINALITY AS i(element)) >= 6 + FROM jsonb_array_elements_text(r."RequiredAssociate" -> 'Ints') WITH ORDINALITY AS i(element)) >= 6 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs index 5060768d6..26200c5a4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionNpgsqlTest.cs @@ -12,236 +12,261 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r """); } - #region Simple properties + #region Scalar properties - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated" ->> 'String' +SELECT r."RequiredAssociate" ->> 'String' FROM "RootEntity" AS r """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated" ->> 'String' +SELECT r."OptionalAssociate" ->> 'String' FROM "RootEntity" AS r """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ -SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +SELECT CAST(r."OptionalAssociate" ->> 'Int' AS integer) FROM "RootEntity" AS r """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ -SELECT CAST(r."OptionalRelated" ->> 'Int' AS integer) +SELECT CAST(r."OptionalAssociate" ->> 'Int' AS integer) FROM "RootEntity" AS r """); } - #endregion Simple properties + #endregion Scalar properties - #region Non-collection + #region Structural properties - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."RequiredRelated", r."Id" +SELECT r."RequiredAssociate", r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."OptionalRelated", r."Id" +SELECT r."OptionalAssociate", r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."RequiredRelated" -> 'RequiredNested', r."Id" +SELECT r."RequiredAssociate" -> 'RequiredNestedAssociate', r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."RequiredRelated" -> 'OptionalNested', r."Id" +SELECT r."RequiredAssociate" -> 'OptionalNestedAssociate', r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."OptionalRelated" -> 'RequiredNested', r."Id" +SELECT r."OptionalAssociate" -> 'RequiredNestedAssociate', r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."OptionalRelated" -> 'OptionalNested', r."Id" +SELECT r."OptionalAssociate" -> 'OptionalNestedAssociate', r."Id" FROM "RootEntity" AS r """); } } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RequiredRelated", r0."Id" +SELECT r0."RequiredAssociate", r0."Id" FROM "RootReferencingEntity" AS r LEFT JOIN "RootEntity" AS r0 ON r."RootEntityId" = r0."Id" """); } } - #endregion Non-collection + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."RequiredAssociate", r."Id" +FROM "RootEntity" AS r +"""); + } + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(r."RequiredAssociate" ->> 'Int' AS integer) +FROM "RootEntity" AS r +"""); + } + + #endregion Structural properties #region Collection - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."RelatedCollection", r."Id" +SELECT r."AssociateCollection", r."Id" FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } } - public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."RequiredRelated" -> 'NestedCollection', r."Id" +SELECT r."RequiredAssociate" -> '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) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."OptionalRelated" -> 'NestedCollection', r."Id" +SELECT r."OptionalAssociate" -> 'NestedCollection', r."Id" FROM "RootEntity" AS r ORDER BY r."Id" NULLS FIRST """); } } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r0."NestedCollection", r0."OptionalNested", r0."RequiredNested" +SELECT r."Id", a."Id", a."Int", a."Ints", a."Name", a."String", a."NestedCollection", a."OptionalNestedAssociate", a."RequiredNestedAssociate" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RelatedCollection") AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."AssociateCollection") AS ( "Id" integer, "Int" integer, "Ints" jsonb, "Name" text, "String" text, "NestedCollection" jsonb, - "OptionalNested" jsonb, - "RequiredNested" jsonb -)) WITH ORDINALITY AS r0 ON TRUE + "OptionalNestedAssociate" jsonb, + "RequiredNestedAssociate" jsonb +)) WITH ORDINALITY AS a ON TRUE """); } } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { @@ -249,7 +274,7 @@ public override async Task SelectMany_nested_collection_on_required_related(Quer """ SELECT r."Id", n."Id", n."Int", n."Ints", n."Name", n."String" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollection') AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -260,9 +285,9 @@ JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."RequiredRelated" -> 'NestedCollect } } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { @@ -270,7 +295,7 @@ public override async Task SelectMany_nested_collection_on_optional_related(Quer """ SELECT r."Id", n."Id", n."Int", n."Ints", n."Name", n."String" FROM "RootEntity" AS r -JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalRelated" -> 'NestedCollection') AS ( +JOIN LATERAL ROWS FROM (jsonb_to_recordset(r."OptionalAssociate" -> 'NestedCollection') AS ( "Id" integer, "Int" integer, "Ints" jsonb, @@ -291,7 +316,7 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r """); } @@ -311,7 +336,7 @@ public override async Task Select_subquery_required_related_FirstOrDefault(Query SELECT r1.c, r1."Id" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."RequiredRelated" -> 'RequiredNested' AS c, r0."Id" + SELECT r0."RequiredAssociate" -> 'RequiredNestedAssociate' AS c, r0."Id" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -331,7 +356,7 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query SELECT r1.c, r1."Id" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."OptionalRelated" -> 'RequiredNested' AS c, r0."Id" + SELECT r0."OptionalAssociate" -> 'RequiredNestedAssociate' AS c, r0."Id" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs index 766096ef0..0889de0fa 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityNpgsqlTest.cs @@ -8,25 +8,25 @@ public class OwnedJsonStructuralEqualityNpgsqlTest( ITestOutputHelper testOutputHelper) : OwnedJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) { - public override async Task Two_related() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE FALSE """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE FALSE """); @@ -38,60 +38,62 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE FALSE """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."OptionalRelated") IS NULL +WHERE (r."OptionalAssociate") IS NULL """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE FALSE """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r -WHERE (r."RequiredRelated" ->> 'OptionalNested') IS NULL +WHERE (r."RequiredAssociate" ->> 'OptionalNestedAssociate') IS NULL """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); - AssertSql(); + AssertSql( +); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_with_parameter(); - AssertSql(); + AssertSql( +); } public override async Task Two_nested_collections() @@ -100,7 +102,7 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated", r."RelatedCollection", r."RequiredRelated" +SELECT r."Id", r."Name", r."AssociateCollection", r."OptionalAssociate", r."RequiredAssociate" FROM "RootEntity" AS r WHERE FALSE """); diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs index 2301219e4..ceda85ec4 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionNpgsqlTest.cs @@ -12,28 +12,28 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."RootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."AssociateTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", 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."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", r6."Name" AS "Name2", r6."String" AS "String2" + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r5."AssociateTypeRootEntityId", r5."AssociateTypeId", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r6."AssociateTypeId" AS "AssociateTypeId0", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r7."AssociateTypeId" AS "AssociateTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."AssociateTypeRootEntityId" AND r4."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."AssociateTypeRootEntityId" AND r4."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."AssociateTypeRootEntityId" AND r4."Id" = r7."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r8."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -43,28 +43,28 @@ public override async Task Where() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."RootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."AssociateTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", 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."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", r6."Name" AS "Name2", r6."String" AS "String2" + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r5."AssociateTypeRootEntityId", r5."AssociateTypeId", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r6."AssociateTypeId" AS "AssociateTypeId0", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r7."AssociateTypeId" AS "AssociateTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."AssociateTypeRootEntityId" AND r4."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."AssociateTypeRootEntityId" AND r4."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."AssociateTypeRootEntityId" AND r4."Id" = r7."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r8."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -74,30 +74,30 @@ public override async Task OrderBy_ElementAt() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."RootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."AssociateTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", 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."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", r6."Name" AS "Name2", r6."String" AS "String2" + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r5."AssociateTypeRootEntityId", r5."AssociateTypeId", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r6."AssociateTypeId" AS "AssociateTypeId0", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r7."AssociateTypeId" AS "AssociateTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."AssociateTypeRootEntityId" AND r4."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."AssociateTypeRootEntityId" AND r4."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."AssociateTypeRootEntityId" AND r4."Id" = r7."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r8."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -109,23 +109,23 @@ public override async Task Distinct() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."RootEntityId", r3."AssociateTypeRootEntityId", r4."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r9."AssociateTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r3 ON r2."RootEntityId" = r3."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r2."RootEntityId" = r4."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", 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."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", r7."Name" AS "Name2", r7."String" AS "String2" + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", r5."Name", r5."String", r6."AssociateTypeRootEntityId", r6."AssociateTypeId", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r7."AssociateTypeId" AS "AssociateTypeId0", r8."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r8."AssociateTypeId" AS "AssociateTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."AssociateTypeRootEntityId" AND r5."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."AssociateTypeRootEntityId" AND r5."Id" = r7."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."AssociateTypeRootEntityId" AND r5."Id" = r8."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."AssociateTypeRootEntityId" WHERE ( SELECT count(*)::int FROM ( @@ -133,7 +133,7 @@ SELECT count(*)::int 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."RootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, r4."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r9."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -145,20 +145,20 @@ public override async Task Distinct_projected(QueryTrackingBehavior queryTrackin { AssertSql( """ -SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."Id00", s."Int00", s."Ints00", s."Name00", s."String00", s."RelatedTypeRootEntityId00", s."RelatedTypeId00", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1" +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."Id00", s."Int00", s."Ints00", s."Name00", s."String00", s."AssociateTypeRootEntityId00", s."AssociateTypeId00", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Ints" AS "Ints0", 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."Ints0" AS "Ints00", r1."Name0" AS "Name00", r1."String0" AS "String00", r1."RelatedTypeRootEntityId0" AS "RelatedTypeRootEntityId00", r1."RelatedTypeId0" AS "RelatedTypeId00", r1."Id1", r1."Int1", r1."Ints1", r1."Name1", r1."String1" + SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Ints" AS "Ints0", r4."Name" AS "Name0", r4."String" AS "String0", r1."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r1."AssociateTypeId" AS "AssociateTypeId0", r1."Id0" AS "Id00", r1."Int0" AS "Int00", r1."Ints0" AS "Ints00", r1."Name0" AS "Name00", r1."String0" AS "String00", r1."AssociateTypeRootEntityId0" AS "AssociateTypeRootEntityId00", r1."AssociateTypeId0" AS "AssociateTypeId00", r1."Id1", r1."Int1", r1."Ints1", r1."Name1", r1."String1" FROM ( - SELECT DISTINCT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r2."RelatedTypeRootEntityId", r2."RelatedTypeId", r2."Id" AS "Id0", r2."Int" AS "Int0", r2."Ints" AS "Ints0", 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."Ints" AS "Ints1", r3."Name" AS "Name1", r3."String" AS "String1" + SELECT DISTINCT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r2."AssociateTypeRootEntityId", r2."AssociateTypeId", r2."Id" AS "Id0", r2."Int" AS "Int0", r2."Ints" AS "Ints0", r2."Name" AS "Name0", r2."String" AS "String0", r3."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r3."AssociateTypeId" AS "AssociateTypeId0", r3."Id" AS "Id1", r3."Int" AS "Int1", r3."Ints" AS "Ints1", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" AND r0."Id" = r2."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" AND r0."Id" = r3."AssociateTypeId" WHERE r."Id" = r0."RootEntityId" ) AS r1 - LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r1."RootEntityId" = r4."RelatedTypeRootEntityId" AND r1."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r1."RootEntityId" = r4."AssociateTypeRootEntityId" AND r1."Id" = r4."AssociateTypeId" ) 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST """); } } @@ -220,30 +220,30 @@ public override async Task GroupBy() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."RelatedTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."RootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r8."AssociateTypeRootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", 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."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", r6."Name" AS "Name2", r6."String" AS "String2" + SELECT r4."RootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r5."AssociateTypeRootEntityId", r5."AssociateTypeId", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r6."AssociateTypeId" AS "AssociateTypeId0", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r7."AssociateTypeId" AS "AssociateTypeId1", r7."Id" AS "Id0", r7."Int" AS "Int0", r7."Ints" AS "Ints0", r7."Name" AS "Name0", r7."String" AS "String0", r5."Id" AS "Id1", r5."Int" AS "Int1", r5."Ints" AS "Ints1", r5."Name" AS "Name1", r5."String" AS "String1", r6."Id" AS "Id2", r6."Int" AS "Int2", r6."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r5 ON r4."RootEntityId" = r5."AssociateTypeRootEntityId" AND r4."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r6 ON r4."RootEntityId" = r6."AssociateTypeRootEntityId" AND r4."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r7 ON r4."RootEntityId" = r7."AssociateTypeRootEntityId" AND r4."Id" = r7."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r8 ON r1."RootEntityId" = r8."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r8."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -259,7 +259,7 @@ public override async Task Select_within_Select_within_Select_with_aggregates() SELECT COALESCE(sum(( SELECT max(r1."Int") FROM "RelatedCollection_NestedCollection" AS r1 - WHERE r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId")), 0)::int + WHERE r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId")), 0)::int FROM "RelatedCollection" AS r0 WHERE r."Id" = r0."RootEntityId") FROM "RootEntity" AS r diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs index 5a16052bc..fa3d39c68 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousNpgsqlTest.cs @@ -10,87 +10,87 @@ public class OwnedNavigationsMiscellaneousNpgsqlTest( { #region Simple filters - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r."Id", r."Name", r0."RootEntityId", r1."AssociateTypeRootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", 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 "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionNpgsqlTest.cs index 9d0358059..725a747c0 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionNpgsqlTest.cs @@ -9,25 +9,25 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" WHERE cardinality(r0."Ints") = 3 -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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -37,25 +37,25 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" WHERE r0."Ints"[1] = 1 -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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -65,25 +65,25 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" WHERE 3 = ANY (r0."Ints") -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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -93,25 +93,25 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" WHERE 2 = ANY (r0."Ints") -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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -121,25 +121,25 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r."Id", r."Name", r0."RootEntityId", r1."AssociateTypeRootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", 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 "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" WHERE cardinality(r1."Ints") = 3 -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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs index be883cf10..24c01fda7 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionNpgsqlTest.cs @@ -12,32 +12,32 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - #region Simple properties + #region Scalar properties - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ @@ -47,9 +47,9 @@ SELECT r0."String" """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ @@ -59,9 +59,9 @@ SELECT o."String" """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ @@ -71,9 +71,9 @@ SELECT o."Int" """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ @@ -83,239 +83,270 @@ SELECT o."Int" """); } - #endregion Simple properties + #endregion Scalar properties - #region Non-collection + #region Structural properties - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."Id", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String" +SELECT o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."Id", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", 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 +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r1."AssociateTypeRootEntityId", r1."Id", r1."Int", r1."Ints", 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 "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" """); } } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r1."AssociateTypeRootEntityId", r1."Id", r1."Int", r1."Ints", 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" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" """); } } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String" +SELECT o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", 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" +LEFT JOIN "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" """); } } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String" +SELECT o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", 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" +LEFT JOIN "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" """); } } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r."Id", r0."Id", r2."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String" +SELECT r1."RootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r."Id", r0."Id", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", r4."AssociateTypeRootEntityId", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r3."Id", r3."Int", r3."Ints", 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 +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r3 ON r1."RootEntityId" = r3."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r4 ON r1."RootEntityId" = r4."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."RootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, r4."AssociateTypeRootEntityId" NULLS FIRST """); } } - #endregion Non-collection + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST +"""); + } + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT r0."Int" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated" AS r0 ON r."Id" = r0."RootEntityId" +"""); + } + + #endregion Structural properties #region Collection - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2" +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2" FROM "RootEntity" AS r LEFT JOIN ( - SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", 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."Ints" AS "Ints0", r3."Name" AS "Name0", r3."String" AS "String0", r1."Id" AS "Id1", r1."Int" AS "Int1", r1."Ints" AS "Ints1", r1."Name" AS "Name1", r1."String" AS "String1", r2."Id" AS "Id2", r2."Int" AS "Int2", r2."Ints" AS "Ints2", r2."Name" AS "Name2", r2."String" AS "String2" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r2."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r2."AssociateTypeId" AS "AssociateTypeId0", r3."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r3."AssociateTypeId" AS "AssociateTypeId1", r3."Id" AS "Id0", r3."Int" AS "Int0", r3."Ints" AS "Ints0", r3."Name" AS "Name0", r3."String" AS "String0", r1."Id" AS "Id1", r1."Int" AS "Int1", r1."Ints" AS "Ints1", r1."Name" AS "Name1", r1."String" AS "String1", r2."Id" AS "Id2", r2."Int" AS "Int2", r2."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" AND r0."Id" = r2."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" AND r0."Id" = r3."AssociateTypeId" ) 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST """); } } - public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RootEntityId", r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r."Id", r0."RootEntityId", r1."AssociateTypeRootEntityId", r1."Id", r1."Int", r1."Ints", 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 +LEFT JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", o."RootEntityId", o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String" +SELECT r."Id", o."RootEntityId", o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r2."RelatedTypeRootEntityId", r2."RelatedTypeId", r3."RelatedTypeRootEntityId", r3."RelatedTypeId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r2."AssociateTypeRootEntityId", r2."AssociateTypeId", r3."AssociateTypeRootEntityId", r3."AssociateTypeId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 +LEFT JOIN "RelatedCollection_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" +LEFT JOIN "RelatedCollection_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" AND r0."Id" = r2."AssociateTypeId" +LEFT JOIN "RelatedCollection_NestedCollection" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" AND r0."Id" = r3."AssociateTypeId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r0."Id" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeId" NULLS FIRST """); } } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r1."AssociateTypeRootEntityId", r1."Id", r1."Int", r1."Ints", 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" +INNER JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" """); } } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String" +SELECT o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", 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" +INNER JOIN "OptionalRelated_NestedCollection" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" """); } } @@ -330,33 +361,33 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", o3."RelatedTypeRootEntityId", o3."Id", o3."Int", o3."Ints", o3."Name", o3."String", s0."RootEntityId", s0."Id", s0."Int", s0."Ints", s0."Name", s0."String", s0."RelatedTypeRootEntityId", s0."RelatedTypeId", s0."RelatedTypeRootEntityId0", s0."RelatedTypeId0", s0."RelatedTypeRootEntityId1", s0."RelatedTypeId1", s0."Id0", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."Id1", s0."Int1", s0."Ints1", s0."Name1", s0."String1", s0."Id2", s0."Int2", s0."Ints2", s0."Name2", s0."String2", r12."RelatedTypeRootEntityId", r12."Id", r12."Int", r12."Ints", r12."Name", r12."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", s0."RootEntityId", s0."Id", s0."Int", s0."Ints", s0."Name", s0."String", s0."AssociateTypeRootEntityId", s0."AssociateTypeId", s0."AssociateTypeRootEntityId0", s0."AssociateTypeId0", s0."AssociateTypeRootEntityId1", s0."AssociateTypeId1", s0."Id0", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."Id1", s0."Int1", s0."Ints1", s0."Name1", s0."String1", s0."Id2", s0."Int2", s0."Ints2", s0."Name2", s0."String2", o3."AssociateTypeRootEntityId", o3."Id", o3."Int", o3."Ints", o3."Name", o3."String", r12."AssociateTypeRootEntityId", r12."Id", r12."Int", r12."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) 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 "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r8."RootEntityId", r8."Id", r8."Int", r8."Ints", 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."Ints" AS "Ints0", r11."Name" AS "Name0", r11."String" AS "String0", r9."Id" AS "Id1", r9."Int" AS "Int1", r9."Ints" AS "Ints1", r9."Name" AS "Name1", r9."String" AS "String1", r10."Id" AS "Id2", r10."Int" AS "Int2", r10."Ints" AS "Ints2", r10."Name" AS "Name2", r10."String" AS "String2" + SELECT r8."RootEntityId", r8."Id", r8."Int", r8."Ints", r8."Name", r8."String", r9."AssociateTypeRootEntityId", r9."AssociateTypeId", r10."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r10."AssociateTypeId" AS "AssociateTypeId0", r11."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r11."AssociateTypeId" AS "AssociateTypeId1", r11."Id" AS "Id0", r11."Int" AS "Int0", r11."Ints" AS "Ints0", r11."Name" AS "Name0", r11."String" AS "String0", r9."Id" AS "Id1", r9."Int" AS "Int1", r9."Ints" AS "Ints1", r9."Name" AS "Name1", r9."String" AS "String1", r10."Id" AS "Id2", r10."Int" AS "Int2", r10."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r9 ON r8."RootEntityId" = r9."AssociateTypeRootEntityId" AND r8."Id" = r9."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r10 ON r8."RootEntityId" = r10."AssociateTypeRootEntityId" AND r8."Id" = r10."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r11 ON r8."RootEntityId" = r11."AssociateTypeRootEntityId" AND r8."Id" = r11."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o3 ON o."RootEntityId" = o3."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r12 ON r0."RootEntityId" = r12."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST, r7."Id" NULLS FIRST, s0."RootEntityId" NULLS FIRST, s0."Id" NULLS FIRST, s0."AssociateTypeRootEntityId" NULLS FIRST, s0."AssociateTypeId" NULLS FIRST, s0."AssociateTypeRootEntityId0" NULLS FIRST, s0."AssociateTypeId0" NULLS FIRST, s0."AssociateTypeRootEntityId1" NULLS FIRST, s0."AssociateTypeId1" NULLS FIRST, s0."Id0" NULLS FIRST, o3."AssociateTypeRootEntityId" NULLS FIRST, o3."Id" NULLS FIRST, r12."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -372,13 +403,13 @@ public override async Task Select_subquery_required_related_FirstOrDefault(Query { AssertSql( """ -SELECT s."RelatedTypeRootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String" +SELECT s."AssociateTypeRootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" + SELECT r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", 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" + LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r1."RootEntityId" = r2."AssociateTypeRootEntityId" ORDER BY r0."Id" NULLS FIRST LIMIT 1 ) AS s ON TRUE @@ -394,13 +425,13 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query { AssertSql( """ -SELECT s."RelatedTypeRootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String" +SELECT s."AssociateTypeRootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String" + SELECT o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", 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" + LEFT JOIN "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" ORDER BY r0."Id" NULLS FIRST LIMIT 1 ) AS s ON TRUE diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs index 0c9b3c341..df2b2f459 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsNpgsqlTest.cs @@ -8,29 +8,29 @@ public class OwnedNavigationsSetOperationsNpgsqlTest( ITestOutputHelper testOutputHelper) : OwnedNavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) { - public override async Task On_related() + public override async Task Over_associate_collections() { - await base.On_related(); + await base.Over_associate_collections(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."RootEntityId", r3."AssociateTypeRootEntityId", r4."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r9."AssociateTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r3 ON r2."RootEntityId" = r3."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r2."RootEntityId" = r4."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", 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."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", r7."Name" AS "Name2", r7."String" AS "String2" + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", r5."Name", r5."String", r6."AssociateTypeRootEntityId", r6."AssociateTypeId", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r7."AssociateTypeId" AS "AssociateTypeId0", r8."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r8."AssociateTypeId" AS "AssociateTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."AssociateTypeRootEntityId" AND r5."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."AssociateTypeRootEntityId" AND r5."Id" = r7."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."AssociateTypeRootEntityId" AND r5."Id" = r8."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r2."RootEntityId" = r9."AssociateTypeRootEntityId" WHERE ( SELECT count(*)::int FROM ( @@ -42,16 +42,16 @@ 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."RootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, r4."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r9."AssociateTypeRootEntityId" NULLS FIRST """); } - public override Task On_related_projected(QueryTrackingBehavior queryTrackingBehavior) - => Assert.ThrowsAnyAsync(() => base.On_related_projected(queryTrackingBehavior)); + public override Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) + => Assert.ThrowsAnyAsync(() => base.Over_associate_collection_projected(queryTrackingBehavior)); - public override async Task On_related_Select_nested_with_aggregates(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) { - await base.On_related_Select_nested_with_aggregates(queryTrackingBehavior); + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); AssertSql( """ @@ -59,7 +59,7 @@ public override async Task On_related_Select_nested_with_aggregates(QueryTrackin 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 + WHERE u."RootEntityId" = r2."AssociateTypeRootEntityId" AND u."Id" = r2."AssociateTypeId")), 0)::int FROM ( SELECT r0."RootEntityId", r0."Id" FROM "RelatedCollection" AS r0 @@ -73,41 +73,41 @@ UNION ALL """); } - public override async Task On_nested() + public override async Task Over_nested_associate_collection() { - await base.On_nested(); + await base.Over_nested_associate_collection(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r3."RelatedTypeRootEntityId", r4."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r9."RelatedTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", r4."Name", r4."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r3."AssociateTypeRootEntityId", r4."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r9."AssociateTypeRootEntityId", r9."Id", r9."Int", r9."Ints", r9."Name", r9."String", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."Id", r4."Int", r4."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r3 ON r0."RootEntityId" = r3."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r4 ON r0."RootEntityId" = r4."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", 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."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", r7."Name" AS "Name2", r7."String" AS "String2" + SELECT r5."RootEntityId", r5."Id", r5."Int", r5."Ints", r5."Name", r5."String", r6."AssociateTypeRootEntityId", r6."AssociateTypeId", r7."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r7."AssociateTypeId" AS "AssociateTypeId0", r8."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r8."AssociateTypeId" AS "AssociateTypeId1", r8."Id" AS "Id0", r8."Int" AS "Int0", r8."Ints" AS "Ints0", r8."Name" AS "Name0", r8."String" AS "String0", r6."Id" AS "Id1", r6."Int" AS "Int1", r6."Ints" AS "Ints1", r6."Name" AS "Name1", r6."String" AS "String1", r7."Id" AS "Id2", r7."Int" AS "Int2", r7."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r6 ON r5."RootEntityId" = r6."AssociateTypeRootEntityId" AND r5."Id" = r6."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r7 ON r5."RootEntityId" = r7."AssociateTypeRootEntityId" AND r5."Id" = r7."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r8 ON r5."RootEntityId" = r8."AssociateTypeRootEntityId" AND r5."Id" = r8."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r0."RootEntityId" = r9."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r9 ON r0."RootEntityId" = r9."AssociateTypeRootEntityId" WHERE ( SELECT count(*)::int FROM ( SELECT 1 FROM "RequiredRelated_NestedCollection" AS r1 - WHERE r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r1."Int" = 8 + WHERE r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r1."Int" = 8 UNION ALL SELECT 1 FROM "RequiredRelated_NestedCollection" AS r2 - WHERE r0."RootEntityId" = r2."RelatedTypeRootEntityId" AND r2."String" = 'foo' + WHERE r0."RootEntityId" = r2."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r3."AssociateTypeRootEntityId" NULLS FIRST, r4."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r9."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -115,7 +115,8 @@ public override async Task Over_different_collection_properties() { await base.Over_different_collection_properties(); - AssertSql(); + AssertSql( +); } [ConditionalFact] diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs index 80974a575..4df9d8bbc 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityNpgsqlTest.cs @@ -8,59 +8,59 @@ public class OwnedNavigationsStructuralEqualityNpgsqlTest( ITestOutputHelper testOutputHelper) : OwnedNavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) { - public override async Task Two_related() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String" +SELECT r."Id", r."Name", r0."RootEntityId", r1."AssociateTypeRootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r1."Id", r1."Int", r1."Ints", 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 "RequiredRelated_RequiredNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" 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 "OptionalRelated_RequiredNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_OptionalNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -70,126 +70,126 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r0."RootEntityId", r1."RelatedTypeRootEntityId", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", r0."RootEntityId", r1."AssociateTypeRootEntityId", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" +WHERE r1."AssociateTypeRootEntityId" IS NULL +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); AssertSql( - ); +); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_with_parameter(); AssertSql( - ); +); } public override async Task Two_nested_collections() @@ -198,25 +198,25 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT r."Id", r."Name", o."RootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", o0."RelatedTypeRootEntityId", o1."RelatedTypeRootEntityId", r0."RootEntityId", r1."RelatedTypeRootEntityId", r2."RelatedTypeRootEntityId", o2."RelatedTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."RelatedTypeRootEntityId0", s."RelatedTypeId0", s."RelatedTypeRootEntityId1", s."RelatedTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."RelatedTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String" +SELECT r."Id", r."Name", o."RootEntityId", o0."AssociateTypeRootEntityId", o1."AssociateTypeRootEntityId", r0."RootEntityId", r1."AssociateTypeRootEntityId", r2."AssociateTypeRootEntityId", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."AssociateTypeRootEntityId0", s."AssociateTypeId0", s."AssociateTypeRootEntityId1", s."AssociateTypeId1", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."Int2", s."Ints2", s."Name2", s."String2", o."Id", o."Int", o."Ints", o."Name", o."String", o2."AssociateTypeRootEntityId", o2."Id", o2."Int", o2."Ints", o2."Name", o2."String", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", o1."Id", o1."Int", o1."Ints", o1."Name", o1."String", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r7."AssociateTypeRootEntityId", r7."Id", r7."Int", r7."Ints", r7."Name", r7."String", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r2."Id", r2."Int", r2."Ints", 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 "OptionalRelated_OptionalNested" AS o0 ON o."RootEntityId" = o0."AssociateTypeRootEntityId" +LEFT JOIN "OptionalRelated_RequiredNested" AS o1 ON o."RootEntityId" = o1."AssociateTypeRootEntityId" 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 "RequiredRelated_OptionalNested" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_RequiredNested" AS r2 ON r0."RootEntityId" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", 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."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", r5."Name" AS "Name2", r5."String" AS "String2" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r5."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId0", r5."AssociateTypeId" AS "AssociateTypeId0", r6."AssociateTypeRootEntityId" AS "AssociateTypeRootEntityId1", r6."AssociateTypeId" AS "AssociateTypeId1", r6."Id" AS "Id0", r6."Int" AS "Int0", r6."Ints" AS "Ints0", r6."Name" AS "Name0", r6."String" AS "String0", r4."Id" AS "Id1", r4."Int" AS "Int1", r4."Ints" AS "Ints1", r4."Name" AS "Name1", r4."String" AS "String1", r5."Id" AS "Id2", r5."Int" AS "Int2", r5."Ints" AS "Ints2", 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" + LEFT JOIN "RelatedCollection_OptionalNested" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" + LEFT JOIN "RelatedCollection_RequiredNested" AS r5 ON r3."RootEntityId" = r5."AssociateTypeRootEntityId" AND r3."Id" = r5."AssociateTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r6 ON r3."RootEntityId" = r6."AssociateTypeRootEntityId" AND r3."Id" = r6."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o2 ON o."RootEntityId" = o2."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r7 ON r0."RootEntityId" = r7."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, o."RootEntityId" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o1."AssociateTypeRootEntityId" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."AssociateTypeRootEntityId0" NULLS FIRST, s."AssociateTypeId0" NULLS FIRST, s."AssociateTypeRootEntityId1" NULLS FIRST, s."AssociateTypeId1" NULLS FIRST, s."Id0" NULLS FIRST, o2."AssociateTypeRootEntityId" NULLS FIRST, o2."Id" NULLS FIRST, r7."AssociateTypeRootEntityId" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs index 514373b2d..3efb87879 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousNpgsqlTest.cs @@ -10,69 +10,69 @@ public class OwnedTableSplittingMiscellaneousNpgsqlTest( { #region Simple filters - public override async Task Where_related_property() + public override async Task Where_on_associate_scalar_property() { - await base.Where_related_property(); + await base.Where_on_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."RequiredAssociate_Int" = 8 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Where_optional_related_property() + public override async Task Where_on_optional_associate_scalar_property() { - await base.Where_optional_related_property(); + await base.Where_on_optional_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."OptionalAssociate_Int" = 8 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Where_nested_related_property() + public override async Task Where_on_nested_associate_scalar_property() { - await base.Where_nested_related_property(); + await base.Where_on_nested_associate_scalar_property(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."RequiredAssociate_RequiredNestedAssociate_Int" = 8 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionNpgsqlTest.cs index 579e65eed..690846515 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionNpgsqlTest.cs @@ -9,19 +9,19 @@ public override async Task Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" -WHERE cardinality(r."RequiredRelated_Ints") = 3 -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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE cardinality(r."RequiredAssociate_Ints") = 3 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -31,19 +31,19 @@ public override async Task Index() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" -WHERE r."RequiredRelated_Ints"[1] = 1 -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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."RequiredAssociate_Ints"[1] = 1 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -53,19 +53,19 @@ public override async Task Contains() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" -WHERE 3 = ANY (r."RequiredRelated_Ints") -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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE 3 = ANY (r."RequiredAssociate_Ints") +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -75,19 +75,19 @@ public override async Task Any_predicate() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" -WHERE 2 = ANY (r."RequiredRelated_Ints") -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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE 2 = ANY (r."RequiredAssociate_Ints") +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -97,19 +97,19 @@ public override async Task Nested_Count() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" -WHERE cardinality(r."RequiredRelated_RequiredNested_Ints") = 3 -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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE cardinality(r."RequiredAssociate_RequiredNestedAssociate_Ints") = 3 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -121,11 +121,11 @@ public override async Task Select_Sum() """ SELECT ( SELECT COALESCE(sum(r1.value), 0)::int - FROM unnest(r."RequiredRelated_Ints") AS r1(value)) + FROM unnest(r."RequiredAssociate_Ints") AS r1(value)) FROM "RootEntity" AS r WHERE ( SELECT COALESCE(sum(r0.value), 0)::int - FROM unnest(r."RequiredRelated_Ints") AS r0(value)) >= 6 + FROM unnest(r."RequiredAssociate_Ints") AS r0(value)) >= 6 """); } diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs index 32745acfa..4000b9bb6 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionNpgsqlTest.cs @@ -12,63 +12,63 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } #region Simple properties - public override async Task Select_property_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_required_related(queryTrackingBehavior); + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."RequiredRelated_String" +SELECT r."RequiredAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_property_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_property_on_optional_related(queryTrackingBehavior); + await base.Select_property_on_optional_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_String" +SELECT r."OptionalAssociate_String" FROM "RootEntity" AS r """); } - public override async Task Select_value_type_property_on_null_related_throws(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_value_type_property_on_null_related_throws(queryTrackingBehavior); + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_Int" +SELECT r."OptionalAssociate_Int" FROM "RootEntity" AS r """); } - public override async Task Select_nullable_value_type_property_on_null_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nullable_value_type_property_on_null_related(queryTrackingBehavior); + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); AssertSql( """ -SELECT r."OptionalRelated_Int" +SELECT r."OptionalAssociate_Int" FROM "RootEntity" AS r """); } @@ -77,216 +77,243 @@ SELECT r."OptionalRelated_Int" #region Non-collection - public override async Task Select_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related(queryTrackingBehavior); + await base.Select_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r0."AssociateTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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 +LEFT JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_related(queryTrackingBehavior); + await base.Select_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +SELECT r."Id", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_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_Ints" 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 + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_required_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_required_related(queryTrackingBehavior); + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } } - public override async Task Select_optional_nested_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_required_related(queryTrackingBehavior); + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String" +SELECT r."Id", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String" FROM "RootEntity" AS r """); } } - public override async Task Select_required_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_nested_on_optional_related(queryTrackingBehavior); + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String" +SELECT r."Id", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r """); } } - public override async Task Select_optional_nested_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_optional_nested_on_optional_related(queryTrackingBehavior); + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String" +SELECT r."Id", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String" FROM "RootEntity" AS r """); } } - public override async Task Select_required_related_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_required_related_via_optional_navigation(queryTrackingBehavior); + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."Id", r0."RequiredRelated_Id", r0."RequiredRelated_Int", r0."RequiredRelated_Ints", r0."RequiredRelated_Name", r0."RequiredRelated_String", r."Id", r1."RelatedTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r0."RequiredRelated_OptionalNested_Id", r0."RequiredRelated_OptionalNested_Int", r0."RequiredRelated_OptionalNested_Ints", r0."RequiredRelated_OptionalNested_Name", r0."RequiredRelated_OptionalNested_String", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Ints", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" +SELECT r0."Id", r0."RequiredAssociate_Id", r0."RequiredAssociate_Int", r0."RequiredAssociate_Ints", r0."RequiredAssociate_Name", r0."RequiredAssociate_String", r."Id", r1."AssociateTypeRootEntityId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r0."RequiredAssociate_OptionalNestedAssociate_Id", r0."RequiredAssociate_OptionalNestedAssociate_Int", r0."RequiredAssociate_OptionalNestedAssociate_Ints", r0."RequiredAssociate_OptionalNestedAssociate_Name", r0."RequiredAssociate_OptionalNestedAssociate_String", r0."RequiredAssociate_RequiredNestedAssociate_Id", r0."RequiredAssociate_RequiredNestedAssociate_Int", r0."RequiredAssociate_RequiredNestedAssociate_Ints", r0."RequiredAssociate_RequiredNestedAssociate_Name", r0."RequiredAssociate_RequiredNestedAssociate_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 +LEFT JOIN "RequiredRelated_NestedCollection" AS r1 ON r0."Id" = r1."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."Id" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST +"""); + } + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT r."Id", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r0."AssociateTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String" +FROM "RootEntity" AS r +LEFT JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."AssociateTypeRootEntityId" NULLS FIRST """); } } + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT r."RequiredAssociate_Int" +FROM "RootEntity" AS r +"""); + } + #endregion Non-collection #region Collection - public override async Task Select_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_related_collection(queryTrackingBehavior); + await base.Select_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String" +SELECT r."Id", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String" FROM "RootEntity" AS r LEFT JOIN ( - SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST """); } } - public override async Task Select_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_required_related(queryTrackingBehavior); + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String" +SELECT r."Id", r0."AssociateTypeRootEntityId", r0."Id", r0."Int", r0."Ints", 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 +LEFT JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, r0."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task Select_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.Select_nested_collection_on_optional_related(queryTrackingBehavior); + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r."Id", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String" +SELECT r."Id", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", 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_Ints" 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 + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST """); } } - public override async Task SelectMany_related_collection(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_related_collection(queryTrackingBehavior); + await base.SelectMany_associate_collection(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" +SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r."Id", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id", r1."Int", r1."Ints", r1."Name", r1."String", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_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 +LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" +ORDER BY r."Id" NULLS FIRST, r0."RootEntityId" NULLS FIRST, r0."Id" NULLS FIRST, r1."AssociateTypeRootEntityId" NULLS FIRST, r1."AssociateTypeId" NULLS FIRST """); } } - public override async Task SelectMany_nested_collection_on_required_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_required_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT r0."RelatedTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String" +SELECT r0."AssociateTypeRootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String" FROM "RootEntity" AS r -INNER JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."RelatedTypeRootEntityId" +INNER JOIN "RequiredRelated_NestedCollection" AS r0 ON r."Id" = r0."AssociateTypeRootEntityId" """); } } - public override async Task SelectMany_nested_collection_on_optional_related(QueryTrackingBehavior queryTrackingBehavior) + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) { - await base.SelectMany_nested_collection_on_optional_related(queryTrackingBehavior); + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) { AssertSql( """ -SELECT o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String" +SELECT o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", 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_Ints" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" -END = o."RelatedTypeRootEntityId" + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" """); } } @@ -301,27 +328,27 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String", o0."RelatedTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", s0."RootEntityId", s0."Id", s0."Int", s0."Ints", s0."Name", s0."String", s0."RelatedTypeRootEntityId", s0."RelatedTypeId", s0."Id0", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."OptionalNested_Id", s0."OptionalNested_Int", s0."OptionalNested_Ints", s0."OptionalNested_Name", s0."OptionalNested_String", s0."RequiredNested_Id", s0."RequiredNested_Int", s0."RequiredNested_Ints", s0."RequiredNested_Name", s0."RequiredNested_String", r5."RelatedTypeRootEntityId", r5."Id", r5."Int", r5."Ints", r5."Name", r5."String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_String", s0."RootEntityId", s0."Id", s0."Int", s0."Ints", s0."Name", s0."String", s0."AssociateTypeRootEntityId", s0."AssociateTypeId", s0."Id0", s0."Int0", s0."Ints0", s0."Name0", s0."String0", s0."OptionalNestedAssociate_Id", s0."OptionalNestedAssociate_Int", s0."OptionalNestedAssociate_Ints", s0."OptionalNestedAssociate_Name", s0."OptionalNestedAssociate_String", s0."RequiredNestedAssociate_Id", s0."RequiredNestedAssociate_Int", s0."RequiredNestedAssociate_Ints", s0."RequiredNestedAssociate_Name", s0."RequiredNestedAssociate_String", o0."AssociateTypeRootEntityId", o0."Id", o0."Int", o0."Ints", o0."Name", o0."String", r5."AssociateTypeRootEntityId", r5."Id", r5."Int", r5."Ints", 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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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_Ints" 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 "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" LEFT JOIN ( - SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."RelatedTypeRootEntityId", r4."RelatedTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Ints" AS "Ints0", r4."Name" AS "Name0", r4."String" AS "String0", r3."OptionalNested_Id", r3."OptionalNested_Int", r3."OptionalNested_Ints", r3."OptionalNested_Name", r3."OptionalNested_String", r3."RequiredNested_Id", r3."RequiredNested_Int", r3."RequiredNested_Ints", r3."RequiredNested_Name", r3."RequiredNested_String" + SELECT r3."RootEntityId", r3."Id", r3."Int", r3."Ints", r3."Name", r3."String", r4."AssociateTypeRootEntityId", r4."AssociateTypeId", r4."Id" AS "Id0", r4."Int" AS "Int0", r4."Ints" AS "Ints0", r4."Name" AS "Name0", r4."String" AS "String0", r3."OptionalNestedAssociate_Id", r3."OptionalNestedAssociate_Int", r3."OptionalNestedAssociate_Ints", r3."OptionalNestedAssociate_Name", r3."OptionalNestedAssociate_String", r3."RequiredNestedAssociate_Id", r3."RequiredNestedAssociate_Int", r3."RequiredNestedAssociate_Ints", r3."RequiredNestedAssociate_Name", r3."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r3 - LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r3."RootEntityId" = r4."RelatedTypeRootEntityId" AND r3."Id" = r4."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r4 ON r3."RootEntityId" = r4."AssociateTypeRootEntityId" AND r3."Id" = r4."AssociateTypeId" ) 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o0 ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o0."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r5 ON r."Id" = r5."AssociateTypeRootEntityId" +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST, r2."Id" NULLS FIRST, s0."RootEntityId" NULLS FIRST, s0."Id" NULLS FIRST, s0."AssociateTypeRootEntityId" NULLS FIRST, s0."AssociateTypeId" NULLS FIRST, s0."Id0" NULLS FIRST, o0."AssociateTypeRootEntityId" NULLS FIRST, o0."Id" NULLS FIRST, r5."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -337,10 +364,10 @@ public override async Task Select_subquery_required_related_FirstOrDefault(Query { AssertSql( """ -SELECT r1."Id", r1."RequiredRelated_RequiredNested_Id", r1."RequiredRelated_RequiredNested_Int", r1."RequiredRelated_RequiredNested_Ints", r1."RequiredRelated_RequiredNested_Name", r1."RequiredRelated_RequiredNested_String" +SELECT r1."Id", r1."RequiredAssociate_RequiredNestedAssociate_Id", r1."RequiredAssociate_RequiredNestedAssociate_Int", r1."RequiredAssociate_RequiredNestedAssociate_Ints", r1."RequiredAssociate_RequiredNestedAssociate_Name", r1."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."Id", r0."RequiredRelated_RequiredNested_Id", r0."RequiredRelated_RequiredNested_Int", r0."RequiredRelated_RequiredNested_Ints", r0."RequiredRelated_RequiredNested_Name", r0."RequiredRelated_RequiredNested_String" + SELECT r0."Id", r0."RequiredAssociate_RequiredNestedAssociate_Id", r0."RequiredAssociate_RequiredNestedAssociate_Int", r0."RequiredAssociate_RequiredNestedAssociate_Ints", r0."RequiredAssociate_RequiredNestedAssociate_Name", r0."RequiredAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 @@ -357,10 +384,10 @@ public override async Task Select_subquery_optional_related_FirstOrDefault(Query { AssertSql( """ -SELECT r1."Id", r1."OptionalRelated_RequiredNested_Id", r1."OptionalRelated_RequiredNested_Int", r1."OptionalRelated_RequiredNested_Ints", r1."OptionalRelated_RequiredNested_Name", r1."OptionalRelated_RequiredNested_String" +SELECT r1."Id", r1."OptionalAssociate_RequiredNestedAssociate_Id", r1."OptionalAssociate_RequiredNestedAssociate_Int", r1."OptionalAssociate_RequiredNestedAssociate_Ints", r1."OptionalAssociate_RequiredNestedAssociate_Name", r1."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r LEFT JOIN LATERAL ( - SELECT r0."Id", r0."OptionalRelated_RequiredNested_Id", r0."OptionalRelated_RequiredNested_Int", r0."OptionalRelated_RequiredNested_Ints", r0."OptionalRelated_RequiredNested_Name", r0."OptionalRelated_RequiredNested_String" + SELECT r0."Id", r0."OptionalAssociate_RequiredNestedAssociate_Id", r0."OptionalAssociate_RequiredNestedAssociate_Int", r0."OptionalAssociate_RequiredNestedAssociate_Ints", r0."OptionalAssociate_RequiredNestedAssociate_Name", r0."OptionalAssociate_RequiredNestedAssociate_String" FROM "RootEntity" AS r0 ORDER BY r0."Id" NULLS FIRST LIMIT 1 diff --git a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs index ded85494d..772119fcd 100644 --- a/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityNpgsqlTest.cs @@ -8,47 +8,47 @@ public class OwnedTableSplittingStructuralEqualityNpgsqlTest( ITestOutputHelper testOutputHelper) : OwnedTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) { - public override async Task Two_related() + public override async Task Two_associates() { - await base.Two_related(); + await base.Two_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Two_nested() + public override async Task Two_nested_associates() { - await base.Two_nested(); + await base.Two_nested_associates(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } @@ -58,104 +58,104 @@ public override async Task Not_equals() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Related_with_inline_null() + public override async Task Associate_with_inline_null() { - await base.Related_with_inline_null(); + await base.Associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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_Ints" 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."OptionalAssociate_Id" IS NULL OR r."OptionalAssociate_Int" IS NULL OR r."OptionalAssociate_Ints" IS NULL OR r."OptionalAssociate_Name" IS NULL OR r."OptionalAssociate_String" IS NULL +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Related_with_parameter_null() + public override async Task Associate_with_parameter_null() { - await base.Related_with_parameter_null(); + await base.Associate_with_parameter_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" WHERE CASE - WHEN r."OptionalRelated_Id" IS NOT NULL AND r."OptionalRelated_Int" IS NOT NULL AND r."OptionalRelated_Ints" IS NOT NULL AND r."OptionalRelated_Name" IS NOT NULL AND r."OptionalRelated_String" IS NOT NULL THEN r."Id" + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Nested_with_inline_null() + public override async Task Nested_associate_with_inline_null() { - await base.Nested_with_inline_null(); + await base.Nested_associate_with_inline_null(); AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) 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_Ints" 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 +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" +WHERE r."RequiredAssociate_OptionalNestedAssociate_Id" IS NULL OR r."RequiredAssociate_OptionalNestedAssociate_Int" IS NULL OR r."RequiredAssociate_OptionalNestedAssociate_Ints" IS NULL OR r."RequiredAssociate_OptionalNestedAssociate_Name" IS NULL OR r."RequiredAssociate_OptionalNestedAssociate_String" IS NULL +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); } - public override async Task Nested_with_inline() + public override async Task Nested_associate_with_inline() { - await base.Nested_with_inline(); + await base.Nested_associate_with_inline(); AssertSql( - ); +); } - public override async Task Nested_with_parameter() + public override async Task Nested_associate_with_parameter() { - await base.Nested_with_parameter(); + await base.Nested_associate_with_parameter(); AssertSql( - ); +); } public override async Task Two_nested_collections() @@ -164,19 +164,19 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT r."Id", r."Name", r."OptionalRelated_Id", r."OptionalRelated_Int", r."OptionalRelated_Ints", r."OptionalRelated_Name", r."OptionalRelated_String", o."RelatedTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalRelated_OptionalNested_Id", r."OptionalRelated_OptionalNested_Int", r."OptionalRelated_OptionalNested_Ints", r."OptionalRelated_OptionalNested_Name", r."OptionalRelated_OptionalNested_String", r."OptionalRelated_RequiredNested_Id", r."OptionalRelated_RequiredNested_Int", r."OptionalRelated_RequiredNested_Ints", r."OptionalRelated_RequiredNested_Name", r."OptionalRelated_RequiredNested_String", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."RelatedTypeRootEntityId", s."RelatedTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNested_Id", s."OptionalNested_Int", s."OptionalNested_Ints", s."OptionalNested_Name", s."OptionalNested_String", s."RequiredNested_Id", s."RequiredNested_Int", s."RequiredNested_Ints", s."RequiredNested_Name", s."RequiredNested_String", r."RequiredRelated_Id", r."RequiredRelated_Int", r."RequiredRelated_Ints", r."RequiredRelated_Name", r."RequiredRelated_String", r2."RelatedTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredRelated_OptionalNested_Id", r."RequiredRelated_OptionalNested_Int", r."RequiredRelated_OptionalNested_Ints", r."RequiredRelated_OptionalNested_Name", r."RequiredRelated_OptionalNested_String", r."RequiredRelated_RequiredNested_Id", r."RequiredRelated_RequiredNested_Int", r."RequiredRelated_RequiredNested_Ints", r."RequiredRelated_RequiredNested_Name", r."RequiredRelated_RequiredNested_String" +SELECT r."Id", r."Name", s."RootEntityId", s."Id", s."Int", s."Ints", s."Name", s."String", s."AssociateTypeRootEntityId", s."AssociateTypeId", s."Id0", s."Int0", s."Ints0", s."Name0", s."String0", s."OptionalNestedAssociate_Id", s."OptionalNestedAssociate_Int", s."OptionalNestedAssociate_Ints", s."OptionalNestedAssociate_Name", s."OptionalNestedAssociate_String", s."RequiredNestedAssociate_Id", s."RequiredNestedAssociate_Int", s."RequiredNestedAssociate_Ints", s."RequiredNestedAssociate_Name", s."RequiredNestedAssociate_String", r."OptionalAssociate_Id", r."OptionalAssociate_Int", r."OptionalAssociate_Ints", r."OptionalAssociate_Name", r."OptionalAssociate_String", o."AssociateTypeRootEntityId", o."Id", o."Int", o."Ints", o."Name", o."String", r."OptionalAssociate_OptionalNestedAssociate_Id", r."OptionalAssociate_OptionalNestedAssociate_Int", r."OptionalAssociate_OptionalNestedAssociate_Ints", r."OptionalAssociate_OptionalNestedAssociate_Name", r."OptionalAssociate_OptionalNestedAssociate_String", r."OptionalAssociate_RequiredNestedAssociate_Id", r."OptionalAssociate_RequiredNestedAssociate_Int", r."OptionalAssociate_RequiredNestedAssociate_Ints", r."OptionalAssociate_RequiredNestedAssociate_Name", r."OptionalAssociate_RequiredNestedAssociate_String", r."RequiredAssociate_Id", r."RequiredAssociate_Int", r."RequiredAssociate_Ints", r."RequiredAssociate_Name", r."RequiredAssociate_String", r2."AssociateTypeRootEntityId", r2."Id", r2."Int", r2."Ints", r2."Name", r2."String", r."RequiredAssociate_OptionalNestedAssociate_Id", r."RequiredAssociate_OptionalNestedAssociate_Int", r."RequiredAssociate_OptionalNestedAssociate_Ints", r."RequiredAssociate_OptionalNestedAssociate_Name", r."RequiredAssociate_OptionalNestedAssociate_String", r."RequiredAssociate_RequiredNestedAssociate_Id", r."RequiredAssociate_RequiredNestedAssociate_Int", r."RequiredAssociate_RequiredNestedAssociate_Ints", r."RequiredAssociate_RequiredNestedAssociate_Name", r."RequiredAssociate_RequiredNestedAssociate_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_Ints" 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."Ints", r0."Name", r0."String", r1."RelatedTypeRootEntityId", r1."RelatedTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNested_Id", r0."OptionalNested_Int", r0."OptionalNested_Ints", r0."OptionalNested_Name", r0."OptionalNested_String", r0."RequiredNested_Id", r0."RequiredNested_Int", r0."RequiredNested_Ints", r0."RequiredNested_Name", r0."RequiredNested_String" + SELECT r0."RootEntityId", r0."Id", r0."Int", r0."Ints", r0."Name", r0."String", r1."AssociateTypeRootEntityId", r1."AssociateTypeId", r1."Id" AS "Id0", r1."Int" AS "Int0", r1."Ints" AS "Ints0", r1."Name" AS "Name0", r1."String" AS "String0", r0."OptionalNestedAssociate_Id", r0."OptionalNestedAssociate_Int", r0."OptionalNestedAssociate_Ints", r0."OptionalNestedAssociate_Name", r0."OptionalNestedAssociate_String", r0."RequiredNestedAssociate_Id", r0."RequiredNestedAssociate_Int", r0."RequiredNestedAssociate_Ints", r0."RequiredNestedAssociate_Name", r0."RequiredNestedAssociate_String" FROM "RelatedCollection" AS r0 - LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."RelatedTypeRootEntityId" AND r0."Id" = r1."RelatedTypeId" + LEFT JOIN "RelatedCollection_NestedCollection" AS r1 ON r0."RootEntityId" = r1."AssociateTypeRootEntityId" AND r0."Id" = r1."AssociateTypeId" ) AS s ON r."Id" = s."RootEntityId" -LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."RelatedTypeRootEntityId" +LEFT JOIN "OptionalRelated_NestedCollection" AS o ON CASE + WHEN r."OptionalAssociate_Id" IS NOT NULL AND r."OptionalAssociate_Int" IS NOT NULL AND r."OptionalAssociate_Ints" IS NOT NULL AND r."OptionalAssociate_Name" IS NOT NULL AND r."OptionalAssociate_String" IS NOT NULL THEN r."Id" +END = o."AssociateTypeRootEntityId" +LEFT JOIN "RequiredRelated_NestedCollection" AS r2 ON r."Id" = r2."AssociateTypeRootEntityId" 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 +ORDER BY r."Id" NULLS FIRST, s."RootEntityId" NULLS FIRST, s."Id" NULLS FIRST, s."AssociateTypeRootEntityId" NULLS FIRST, s."AssociateTypeId" NULLS FIRST, s."Id0" NULLS FIRST, o."AssociateTypeRootEntityId" NULLS FIRST, o."Id" NULLS FIRST, r2."AssociateTypeRootEntityId" NULLS FIRST """); }