Npgsql 9.0.4
Npgsql is the open source .NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using .NET.
Quickstart
Here's a basic code snippet to get you started:
var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";
await using var conn = new NpgsqlConnection(connString);
await conn.OpenAsync();
// Insert some data
await using (var cmd = new NpgsqlCommand("INSERT INTO data (some_field) VALUES (@p)", conn))
{
cmd.Parameters.AddWithValue("p", "Hello world");
await cmd.ExecuteNonQueryAsync();
}
// Retrieve all rows
await using (var cmd = new NpgsqlCommand("SELECT some_field FROM data", conn))
await using (var reader = await cmd.ExecuteReaderAsync())
{
while (await reader.ReadAsync())
Console.WriteLine(reader.GetString(0));
}
Key features
- High-performance PostgreSQL driver. Regularly figures in the top contenders on the TechEmpower Web Framework Benchmarks.
- Full support of most PostgreSQL types, including advanced ones such as arrays, enums, ranges, multiranges, composites, JSON, PostGIS and others.
- Highly-efficient bulk import/export API.
- Failover, load balancing and general multi-host support.
- Great integration with Entity Framework Core via Npgsql.EntityFrameworkCore.PostgreSQL.
For the full documentation, please visit the Npgsql website.
Related packages
- The Entity Framework Core provider that works with this provider is Npgsql.EntityFrameworkCore.PostgreSQL.
- Spatial plugin to work with PostgreSQL PostGIS: Npgsql.NetTopologySuite
- NodaTime plugin to use better date/time types with PostgreSQL: Npgsql.NodaTime
- OpenTelemetry support can be set up with Npgsql.OpenTelemetry
Showing the top 20 packages that depend on Npgsql.
| Packages | Downloads |
|---|---|
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
21 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
20 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
|
20 |
|
Net.RunMethodsSequentially
Runs updates to single resources, e.g. a database, on startup of an application that has multiple instances
|
19 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
19 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
18 |
|
TestContainers
Package Description
|
18 |
|
DistributedLock.Postgres
Provides a distributed lock implementation based on Postgresql
|
18 |
|
EntityFrameworkCore.Exceptions.PostgreSQL
Handle database errors easily when working with Entity Framework Core. Catch specific exceptions such as UniqueConstraintException, CannotInsertNullException, MaxLengthExceededException, NumericOverflowException or ReferenceConstraintException instead of generic DbUpdateException
|
17 |
|
Net.RunMethodsSequentially
Runs updates to single resources, e.g. a database, on startup of an application that has multiple instances
|
17 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
17 |
|
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
|
16 |
|
DbExceptionClassifier.PostgreSQL
Classify PostgreSQL database exceptions by error type such as unique constraint violation, foreign key violation, and more
|
16 |
.NET 6.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Json (>= 8.0.5)
.NET 8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.3 | 26 | 06/23/2026 |
| 10.0.2 | 20 | 03/24/2026 |
| 10.0.1 | 17 | 02/18/2026 |
| 10.0.0 | 9 | 12/16/2025 |
| 10.0.0-rc.1 | 16 | 06/23/2026 |
| 9.0.5 | 19 | 06/24/2026 |
| 9.0.4 | 17 | 06/24/2026 |
| 9.0.3 | 21 | 03/23/2026 |
| 9.0.2 | 15 | 06/24/2026 |
| 9.0.1 | 23 | 06/24/2026 |
| 8.0.9 | 18 | 06/24/2026 |
| 8.0.8 | 21 | 06/24/2026 |
| 8.0.7 | 26 | 06/24/2026 |
| 8.0.6 | 16 | 06/24/2026 |
| 8.0.5 | 18 | 11/06/2024 |
| 8.0.4 | 17 | 06/24/2026 |
| 8.0.3 | 20 | 06/24/2026 |
| 8.0.2 | 17 | 06/24/2026 |
| 8.0.1 | 17 | 06/24/2026 |
| 8.0.0 | 12 | 06/24/2026 |
| 8.0.0-rc.2 | 22 | 06/23/2026 |
| 8.0.0-preview.4 | 14 | 06/23/2026 |
| 8.0.0-preview.3 | 17 | 06/23/2026 |
| 8.0.0-preview.2 | 15 | 06/23/2026 |
| 8.0.0-preview.1 | 19 | 06/23/2026 |
| 7.0.10 | 18 | 06/24/2026 |
| 7.0.9 | 10 | 06/24/2026 |
| 7.0.8 | 23 | 06/24/2026 |
| 7.0.7 | 13 | 06/24/2026 |
| 7.0.6 | 17 | 06/24/2026 |
| 7.0.4 | 21 | 06/24/2026 |
| 7.0.2 | 15 | 06/15/2024 |
| 7.0.1 | 16 | 06/24/2026 |
| 7.0.0 | 18 | 06/24/2026 |
| 7.0.0-rc.2 | 16 | 06/23/2026 |
| 7.0.0-rc.1 | 22 | 06/23/2026 |
| 7.0.0-preview.7 | 9 | 06/23/2026 |
| 7.0.0-preview.6 | 12 | 06/29/2026 |
| 7.0.0-preview.5 | 14 | 06/23/2026 |
| 7.0.0-preview.4 | 17 | 06/23/2026 |
| 7.0.0-preview.3 | 15 | 06/23/2026 |
| 7.0.0-preview.2 | 13 | 06/23/2026 |
| 7.0.0-preview.1 | 18 | 06/23/2026 |
| 6.0.13 | 20 | 06/24/2026 |
| 6.0.12 | 24 | 06/27/2026 |
| 6.0.11 | 24 | 06/24/2026 |
| 6.0.10 | 18 | 06/24/2026 |
| 6.0.9 | 11 | 06/24/2026 |
| 6.0.8 | 24 | 06/24/2026 |
| 6.0.7 | 16 | 06/24/2026 |
| 6.0.6 | 10 | 06/24/2026 |
| 6.0.5 | 22 | 06/24/2026 |
| 6.0.4 | 15 | 06/24/2026 |
| 6.0.3 | 15 | 06/24/2026 |
| 6.0.2 | 15 | 06/24/2026 |
| 6.0.1 | 15 | 06/24/2026 |
| 6.0.0 | 16 | 03/31/2022 |
| 6.0.0-rc.2 | 9 | 06/23/2026 |
| 6.0.0-rc.1 | 17 | 06/23/2026 |
| 6.0.0-preview7 | 8 | 07/28/2026 |
| 6.0.0-preview6 | 9 | 06/29/2026 |
| 6.0.0-preview5 | 17 | 06/29/2026 |
| 6.0.0-preview4 | 12 | 06/29/2026 |
| 6.0.0-preview3 | 20 | 06/29/2026 |
| 6.0.0-preview2 | 16 | 06/30/2026 |
| 5.0.18 | 11 | 06/29/2026 |
| 5.0.17 | 14 | 06/29/2026 |
| 5.0.16 | 11 | 06/28/2026 |
| 5.0.15 | 18 | 06/24/2026 |
| 5.0.14 | 16 | 06/29/2026 |
| 5.0.13 | 16 | 06/24/2026 |
| 5.0.12 | 16 | 06/27/2026 |
| 5.0.11 | 12 | 06/24/2026 |
| 5.0.10 | 20 | 06/24/2026 |
| 5.0.7 | 12 | 06/24/2026 |
| 5.0.5 | 15 | 06/24/2026 |
| 5.0.4 | 23 | 06/24/2026 |
| 5.0.3 | 16 | 06/24/2026 |
| 5.0.2 | 15 | 06/24/2026 |
| 5.0.1.1 | 15 | 07/01/2026 |
| 5.0.0 | 18 | 06/24/2026 |
| 4.1.14 | 18 | 06/29/2026 |
| 4.1.13 | 17 | 06/23/2026 |
| 4.1.12 | 18 | 06/24/2026 |
| 4.1.11 | 13 | 06/29/2026 |
| 4.1.10 | 16 | 06/24/2026 |
| 4.1.9 | 14 | 06/24/2026 |
| 4.1.8 | 14 | 06/24/2026 |
| 4.1.7 | 14 | 06/24/2026 |
| 4.1.6 | 11 | 06/24/2026 |
| 4.1.5 | 11 | 06/24/2026 |
| 4.1.4 | 13 | 06/24/2026 |
| 4.1.3.1 | 22 | 06/27/2026 |
| 4.1.3 | 9 | 06/24/2026 |
| 4.1.2 | 14 | 06/24/2026 |
| 4.1.1 | 17 | 06/24/2026 |
| 4.1.0 | 15 | 06/24/2026 |
| 4.0.17 | 16 | 06/29/2026 |
| 4.0.16 | 15 | 07/01/2026 |
| 4.0.14 | 14 | 06/24/2026 |
| 4.0.13 | 21 | 06/24/2026 |
| 4.0.12 | 10 | 06/29/2026 |
| 4.0.11 | 23 | 06/24/2026 |
| 4.0.10 | 23 | 06/24/2026 |
| 4.0.9 | 19 | 06/24/2026 |
| 4.0.8 | 21 | 06/24/2026 |
| 4.0.7 | 21 | 06/24/2026 |
| 4.0.6 | 9 | 06/24/2026 |
| 4.0.5 | 17 | 06/24/2026 |
| 4.0.4 | 16 | 06/24/2026 |
| 4.0.3 | 23 | 06/24/2026 |
| 4.0.2 | 32 | 06/24/2026 |
| 4.0.1 | 16 | 06/24/2026 |
| 4.0.0 | 19 | 06/24/2026 |
| 4.0.0-rc1 | 13 | 06/29/2026 |
| 4.0.0-preview2 | 12 | 06/30/2026 |
| 4.0.0-preview1 | 10 | 06/27/2026 |
| 3.2.7 | 10 | 06/24/2026 |
| 3.2.6 | 16 | 06/24/2026 |
| 3.2.5 | 16 | 06/24/2026 |
| 3.2.4.1 | 14 | 06/29/2026 |
| 3.2.4 | 14 | 06/24/2026 |
| 3.2.3 | 23 | 06/24/2026 |
| 3.2.2 | 13 | 06/24/2026 |
| 3.2.1 | 16 | 06/24/2026 |
| 3.2.0 | 17 | 06/24/2026 |
| 3.1.10 | 8 | 06/23/2026 |
| 3.1.9 | 22 | 06/24/2026 |
| 3.1.8 | 17 | 06/24/2026 |
| 3.1.7 | 20 | 06/24/2026 |
| 3.1.6 | 13 | 06/24/2026 |
| 3.1.5 | 14 | 06/24/2026 |
| 3.1.4 | 22 | 06/24/2026 |
| 3.1.3 | 18 | 06/24/2026 |
| 3.1.2 | 18 | 06/24/2026 |
| 3.1.1 | 16 | 06/24/2026 |
| 3.1.0 | 14 | 06/24/2026 |
| 3.0.8 | 15 | 06/24/2026 |
| 3.0.7 | 16 | 06/24/2026 |
| 3.0.6 | 18 | 06/24/2026 |
| 3.0.5 | 13 | 06/24/2026 |
| 3.0.4 | 8 | 06/24/2026 |
| 3.0.3 | 10 | 06/24/2026 |
| 3.0.2 | 16 | 06/24/2026 |
| 3.0.1 | 16 | 06/24/2026 |
| 3.0.0 | 16 | 06/24/2026 |
| 2.2.7 | 13 | 06/24/2026 |
| 2.2.6 | 20 | 06/24/2026 |
| 2.2.5 | 16 | 06/24/2026 |
| 2.2.4.3 | 14 | 06/30/2026 |
| 2.2.4.1 | 17 | 07/05/2026 |
| 2.2.3 | 18 | 06/24/2026 |
| 2.2.2 | 19 | 06/29/2026 |
| 2.2.1 | 9 | 06/24/2026 |
| 2.2.0 | 12 | 06/24/2026 |
| 2.1.3 | 13 | 06/24/2026 |
| 2.1.2 | 17 | 06/24/2026 |
| 2.1.1 | 7 | 06/24/2026 |
| 2.1.0 | 17 | 06/24/2026 |
| 2.0.14.3 | 16 | 06/24/2026 |
| 2.0.12.1 | 5 | 07/01/2026 |
| 2.0.11 | 19 | 06/24/2026 |