diff --git a/Directory.Packages.props b/Directory.Packages.props index e951f7b65..fa4a353bf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,7 +1,7 @@ - 10.0.0-preview.6.25314.101 - 10.0.0-preview.6.25314.101 + 10.0.0-preview.6.25321.102 + 10.0.0-preview.6.25321.102 9.0.3 diff --git a/test/EFCore.PG.FunctionalTests/Query/NorthwindAggregateOperatorsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/NorthwindAggregateOperatorsQueryNpgsqlTest.cs index 7970d1e5b..2e6d826e1 100644 --- a/test/EFCore.PG.FunctionalTests/Query/NorthwindAggregateOperatorsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/NorthwindAggregateOperatorsQueryNpgsqlTest.cs @@ -67,39 +67,36 @@ public override async Task Contains_with_local_uint_array_closure(bool async) """); } -// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with -// optional parameter, not supported in expression trees). #35547 is tracking on the EF side. -// -// public override async Task Contains_with_local_nullable_uint_array_closure(bool async) -// { -// await base.Contains_with_local_nullable_uint_array_closure(async); -// -// // Note: PostgreSQL doesn't support uint, but value converters make this into bigint -// -// AssertSql( -// """ -// @ids={ '0', '1' } (DbType = Object) -// -// SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title" -// FROM "Employees" AS e -// WHERE e."EmployeeID" = ANY (@ids) -// """, -// // -// """ -// @ids={ '0' } (DbType = Object) -// -// SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title" -// FROM "Employees" AS e -// WHERE e."EmployeeID" = ANY (@ids) -// """); -// } -// -// public override Task Contains_with_local_anonymous_type_array_closure(bool async) -// // Aggregates. Issue #15937. -// => AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(async)); -// -// public override Task Contains_with_local_tuple_array_closure(bool async) -// => Assert.ThrowsAsync(() => base.Contains_with_local_tuple_array_closure(async: true)); + public override async Task Contains_with_local_nullable_uint_array_closure(bool async) + { + await base.Contains_with_local_nullable_uint_array_closure(async); + + // Note: PostgreSQL doesn't support uint, but value converters make this into bigint + + AssertSql( + """ +@ids={ '0', '1' } (DbType = Object) + +SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title" +FROM "Employees" AS e +WHERE e."EmployeeID" = ANY (@ids) +""", + // + """ +@ids={ '0' } (DbType = Object) + +SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title" +FROM "Employees" AS e +WHERE e."EmployeeID" = ANY (@ids) +"""); + } + + public override Task Contains_with_local_anonymous_type_array_closure(bool async) + // Aggregates. Issue #15937. + => AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(async)); + + public override Task Contains_with_local_tuple_array_closure(bool async) + => Assert.ThrowsAsync(() => base.Contains_with_local_tuple_array_closure(async: true)); public override async Task Contains_with_local_enumerable_inline(bool async) { diff --git a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs index 5daa92b91..4ddb4ae83 100644 --- a/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs @@ -22,32 +22,29 @@ public override async Task Inline_collection_of_ints_Contains(bool async) """); } -// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with -// optional parameter, not supported in expression trees). #35547 is tracking on the EF side. -// -// public override async Task Inline_collection_of_nullable_ints_Contains(bool async) -// { -// await base.Inline_collection_of_nullable_ints_Contains(async); -// -// AssertSql( -// """ -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."NullableInt" IN (10, 999) -// """); -// } -// -// public override async Task Inline_collection_of_nullable_ints_Contains_null(bool async) -// { -// await base.Inline_collection_of_nullable_ints_Contains_null(async); -// -// AssertSql( -// """ -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."NullableInt" IS NULL OR p."NullableInt" = 999 -// """); -// } + public override async Task Inline_collection_of_nullable_ints_Contains(bool async) + { + await base.Inline_collection_of_nullable_ints_Contains(async); + + AssertSql( + """ +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."NullableInt" IN (10, 999) +"""); + } + + public override async Task Inline_collection_of_nullable_ints_Contains_null(bool async) + { + await base.Inline_collection_of_nullable_ints_Contains_null(async); + + AssertSql( + """ +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."NullableInt" IS NULL OR p."NullableInt" = 999 +"""); + } public override async Task Inline_collection_Count_with_zero_values(bool async) { @@ -575,52 +572,49 @@ WHERE NOT (p."NullableInt" = ANY (@ints) AND p."NullableInt" = ANY (@ints) IS NO """); } -// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with -// optional parameter, not supported in expression trees). #35547 is tracking on the EF side. -// -// public override async Task Parameter_collection_of_nullable_ints_Contains_int(bool async) -// { -// await base.Parameter_collection_of_nullable_ints_Contains_int(async); -// -// AssertSql( -// """ -// @nullableInts={ '10', '999' } (DbType = Object) -// -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."Int" = ANY (@nullableInts) -// """, -// // -// """ -// @nullableInts={ '10', '999' } (DbType = Object) -// -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE NOT (p."Int" = ANY (@nullableInts) AND p."Int" = ANY (@nullableInts) IS NOT NULL) -// """); -// } -// -// public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int(bool async) -// { -// await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(async); -// -// AssertSql( -// """ -// @nullableInts={ NULL, '999' } (DbType = Object) -// -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."NullableInt" = ANY (@nullableInts) OR (p."NullableInt" IS NULL AND array_position(@nullableInts, NULL) IS NOT NULL) -// """, -// // -// """ -// @nullableInts={ NULL, '999' } (DbType = Object) -// -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE NOT (p."NullableInt" = ANY (@nullableInts) AND p."NullableInt" = ANY (@nullableInts) IS NOT NULL) AND (p."NullableInt" IS NOT NULL OR array_position(@nullableInts, NULL) IS NULL) -// """); -// } + public override async Task Parameter_collection_of_nullable_ints_Contains_int(bool async) + { + await base.Parameter_collection_of_nullable_ints_Contains_int(async); + + AssertSql( + """ +@nullableInts={ '10', '999' } (DbType = Object) + +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."Int" = ANY (@nullableInts) +""", + // + """ +@nullableInts={ '10', '999' } (DbType = Object) + +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE NOT (p."Int" = ANY (@nullableInts) AND p."Int" = ANY (@nullableInts) IS NOT NULL) +"""); + } + + public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int(bool async) + { + await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(async); + + AssertSql( + """ +@nullableInts={ NULL, '999' } (DbType = Object) + +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."NullableInt" = ANY (@nullableInts) OR (p."NullableInt" IS NULL AND array_position(@nullableInts, NULL) IS NOT NULL) +""", + // + """ +@nullableInts={ NULL, '999' } (DbType = Object) + +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE NOT (p."NullableInt" = ANY (@nullableInts) AND p."NullableInt" = ANY (@nullableInts) IS NOT NULL) AND (p."NullableInt" IS NOT NULL OR array_position(@nullableInts, NULL) IS NULL) +"""); + } public override async Task Parameter_collection_of_structs_Contains_struct(bool async) { @@ -760,22 +754,19 @@ public override async Task Parameter_collection_of_bools_Contains(bool async) """); } -// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with -// optional parameter, not supported in expression trees). #35547 is tracking on the EF side. -// -// public override async Task Parameter_collection_of_enums_Contains(bool async) -// { -// await base.Parameter_collection_of_enums_Contains(async); -// -// AssertSql( -// """ -// @enums={ '0', '3' } (DbType = Object) -// -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."Enum" = ANY (@enums) -// """); -// } + public override async Task Parameter_collection_of_enums_Contains(bool async) + { + await base.Parameter_collection_of_enums_Contains(async); + + AssertSql( + """ +@enums={ '0', '3' } (DbType = Object) + +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."Enum" = ANY (@enums) +"""); + } public override async Task Parameter_collection_null_Contains(bool async) { @@ -869,32 +860,29 @@ public override async Task Column_collection_of_ints_Contains(bool async) """); } -// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with -// optional parameter, not supported in expression trees). #35547 is tracking on the EF side. -// -// public override async Task Column_collection_of_nullable_ints_Contains(bool async) -// { -// await base.Column_collection_of_nullable_ints_Contains(async); -// -// AssertSql( -// """ -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE p."NullableInts" @> ARRAY[10]::integer[] -// """); -// } -// -// public override async Task Column_collection_of_nullable_ints_Contains_null(bool async) -// { -// await base.Column_collection_of_nullable_ints_Contains_null(async); -// -// AssertSql( -// """ -// SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" -// FROM "PrimitiveCollectionsEntity" AS p -// WHERE array_position(p."NullableInts", NULL) IS NOT NULL -// """); -// } + public override async Task Column_collection_of_nullable_ints_Contains(bool async) + { + await base.Column_collection_of_nullable_ints_Contains(async); + + AssertSql( + """ +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE p."NullableInts" @> ARRAY[10]::integer[] +"""); + } + + public override async Task Column_collection_of_nullable_ints_Contains_null(bool async) + { + await base.Column_collection_of_nullable_ints_Contains_null(async); + + AssertSql( + """ +SELECT p."Id", p."Bool", p."Bools", p."DateTime", p."DateTimes", p."Enum", p."Enums", p."Int", p."Ints", p."NullableInt", p."NullableInts", p."NullableString", p."NullableStrings", p."NullableWrappedId", p."NullableWrappedIdWithNullableComparer", p."String", p."Strings", p."WrappedId" +FROM "PrimitiveCollectionsEntity" AS p +WHERE array_position(p."NullableInts", NULL) IS NOT NULL +"""); + } public override async Task Column_collection_of_strings_contains_null(bool async) {