diff --git a/conceptual/EFCore.PG/release-notes/10.0.md b/conceptual/EFCore.PG/release-notes/10.0.md index b57db74b..99324703 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.