From bf9553c2f115a529311c768a29ab9af7323caa1d Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 2 Jul 2026 12:15:32 +0200 Subject: [PATCH 1/2] Add 10.0 breaking-change note for array Contains Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- conceptual/EFCore.PG/release-notes/10.0.md | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/conceptual/EFCore.PG/release-notes/10.0.md b/conceptual/EFCore.PG/release-notes/10.0.md index b57db74b..26300b9e 100644 --- a/conceptual/EFCore.PG/release-notes/10.0.md +++ b/conceptual/EFCore.PG/release-notes/10.0.md @@ -159,5 +159,31 @@ See the [10.0.0 milestone](https://github.com/npgsql/efcore.pg/milestone/68?clos ## Breaking changes +### Array `Contains` translation now defaults to `ANY` + +Translation for array `Contains` was changed in 10.0: `arrayColumn.Contains(element)` now defaults to `element = ANY(arrayColumn)` (instead of `arrayColumn @> ARRAY[element]`). This can impact performance depending on your indexes: `@>` can be much faster with a GIN index over the array column, while `ANY` can be better when that GIN index is missing. + +Previous SQL: + +```sql +WHERE array_column @> ARRAY[@__element_0]::text[] +``` + +New default SQL: + +```sql +WHERE @__element_0 = ANY(array_column) +``` + +To tell EF that a GIN index exists and revert to the previous `@>` translation, model that index: + +```csharp +modelBuilder.Entity() + .HasIndex(i => i.ArrayColumn) + .HasMethod("gin"); +``` + +### Other breaking changes + * `EF.Functions.Network()` and `EF.Functions.Merge()` have been changed to return the new .NET [`IPNetwork`](https://learn.microsoft.com/dotnet/api/system.net.ipnetwork) instead of the obsolete `NpgsqlCidr`. The new `IPNetwork` type works with all other functions as well (but no breaking changes were necessary). * The PostgreSQL network type `cidr` is now scaffolded to the new .NET [`IPNetwork`](https://learn.microsoft.com/dotnet/api/system.net.ipnetwork) type. The older Npgsql representation for `cidr` - the `NpgsqlCidr` type - has been obsoleted and will be removed in a future release. From 571cb6e05d3e70f1657b9d4aaf4b895486c9fdf3 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 2 Jul 2026 12:36:52 +0200 Subject: [PATCH 2/2] Align SQL formatting in 10.0 breaking note Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- conceptual/EFCore.PG/release-notes/10.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conceptual/EFCore.PG/release-notes/10.0.md b/conceptual/EFCore.PG/release-notes/10.0.md index 26300b9e..99324703 100644 --- a/conceptual/EFCore.PG/release-notes/10.0.md +++ b/conceptual/EFCore.PG/release-notes/10.0.md @@ -172,7 +172,7 @@ WHERE array_column @> ARRAY[@__element_0]::text[] New default SQL: ```sql -WHERE @__element_0 = ANY(array_column) +WHERE @__element_0 = ANY (array_column) ``` To tell EF that a GIN index exists and revert to the previous `@>` translation, model that index: