EntityFramework-Extensions
EntityFramework-Extensions copied to clipboard
DeleteRangeByKey does not work with PostgreSQL
Description
Postgre database. I am doing a batch deletion of rows from a table and I get an error message.
Code
Set<T>().DeleteRangeByKey(query);
Exception
Exception message:
Oops! The following provider 'Npgsql.NpgsqlConnection is not yet supported by the method DeleteByKey and DeleteRangeByKey. We add provider on demand, so if you wish we support it, report this message to '[email protected]' , v=6.103.5.0
Stack trace:
System.Exception: Oops! The following provider 'Npgsql.NpgsqlConnection is not yet supported by the method DeleteByKey and DeleteRangeByKey. We add provider on demand, so if you wish we support it, report this message to '[email protected]' , v=6.103.5.0
at Z.EntityFramework.Extensions.DeleteByKeyExecutor`1.Prepare()
at Z.EntityFramework.Extensions.DeleteByKeyManager.?[?](DbSet`1 ?, IEnumerable`1 ?)
at DbSetExtensions.DeleteRangeByKey[TEntity,T](DbSet`1 dbSet, IEnumerable`1 entities)
at DeleteRangeByKeyExample.AppDbContext.BatchDelete[T](IQueryable`1 query, Int32 batchCount) in C:\Temp\DeleteRangeByKeyExample\Model.cs:line 53
at DeleteRangeByKeyExample.Program.Main(String[] args) in C:\Temp\DeleteRangeByKeyExample\Program.cs:line 37
at DeleteRangeByKeyExample.Program.<Main>(String[] args)
Further technical details
- EF version: [EF Core v6.0.8]
- EF Extensions version: [EFE Core Core v6.103.5]
- Database Server version: [PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit]
- Database Provider version (NuGet): [Npgsql.EntityFrameworkCore.PostgreSQL v6.0.2]
Project: DeleteRangeByKeyExample.zip
Hello @Alexey39dev ,
Indeed, the DeleteRangeByKey method doesn't currently support PostgreSQL.
We currently have too many requests to add to our short-term plan, but we will need to complete that for 2025.
Best Regards,
Jon