Npgsql 9.0.3

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.

Showing the top 20 packages that depend on Npgsql.

Packages Downloads
TestContainers
Package Description
66
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
57
Marten
Postgresql as a Document Db and Event Store for .Net Development
55
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
54
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
49
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
48
TestContainers
Package Description
48
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
47
Marten
Postgresql as a Document Db and Event Store for .Net Development
46
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
46
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
45
Weasel.Postgresql
Npgsql Helpers and Postgresql Schema Migration Tool, spin off of Marten
44
Marten
Postgresql as a Document Db and Event Store for .Net Development
44

Version Downloads Last updated
9.0.3 14 02/26/2025
9.0.2 13 12/14/2024
9.0.1 15 11/19/2024
9.0.0 18 11/19/2024
8.0.7 11 02/26/2025
8.0.6 16 11/19/2024
8.0.5 18 10/25/2024
8.0.4 18 09/18/2024
8.0.3 36 05/22/2024
8.0.2 20 02/20/2024
8.0.1 18 12/15/2023
8.0.0 16 12/15/2023
8.0.0-rc.2 18 06/29/2024
8.0.0-preview.4 18 08/28/2024
8.0.0-preview.3 19 02/20/2024
8.0.0-preview.2 23 04/03/2023
8.0.0-preview.1 28 06/05/2023
7.0.10 11 03/19/2025
7.0.9 17 11/19/2024
7.0.8 14 10/25/2024
7.0.7 21 05/22/2024
7.0.6 21 07/05/2024
7.0.4 18 02/20/2024
7.0.2 33 06/11/2023
7.0.1 21 06/11/2023
7.0.0 33 04/04/2023
7.0.0-rc.2 20 08/26/2023
7.0.0-rc.1 20 08/23/2023
7.0.0-preview.7 21 12/02/2023
7.0.0-preview.6 20 11/04/2024
7.0.0-preview.5 35 04/02/2023
7.0.0-preview.4 47 04/05/2023
7.0.0-preview.3 18 08/07/2024
7.0.0-preview.2 19 02/20/2024
7.0.0-preview.1 36 03/31/2023
6.0.13 16 11/19/2024
6.0.12 15 09/20/2024
6.0.11 25 05/22/2024
6.0.10 17 01/07/2024
6.0.9 60 04/03/2023
6.0.8 45 03/30/2023
6.0.7 33 04/02/2023
6.0.6 43 04/22/2023
6.0.5 18 06/11/2023
6.0.4 40 04/08/2023
6.0.3 25 06/12/2023
6.0.2 25 06/12/2023
6.0.1 19 06/11/2023
6.0.0 18 06/11/2023
6.0.0-rc.2 15 08/22/2023
6.0.0-rc.1 25 08/22/2023
6.0.0-preview7 25 02/20/2024
6.0.0-preview6 62 04/03/2023
6.0.0-preview5 19 06/29/2024
6.0.0-preview4 16 02/20/2024
6.0.0-preview3 16 06/29/2024
6.0.0-preview2 40 04/21/2023
5.0.18 24 05/22/2024
5.0.17 15 12/15/2023
5.0.16 14 09/03/2024
5.0.15 20 06/13/2023
5.0.14 19 04/11/2023
5.0.13 53 03/30/2023
5.0.12 26 06/13/2023
5.0.11 21 03/30/2023
5.0.10 40 03/30/2023
5.0.7 20 03/20/2023
5.0.5 45 05/18/2021
5.0.4 22 06/12/2023
5.0.3 49 03/30/2023
5.0.2 25 06/12/2023
5.0.1.1 30 03/27/2023
5.0.0 20 04/03/2023
4.1.14 35 05/22/2024
4.1.13 21 05/22/2024
4.1.12 17 06/13/2023
4.1.11 40 05/06/2023
4.1.10 49 04/22/2023
4.1.9 36 04/06/2023
4.1.8 15 09/03/2022
4.1.7 18 06/11/2023
4.1.6 65 03/30/2023
4.1.5 23 06/11/2023
4.1.4 17 06/11/2023
4.1.3.1 18 08/21/2023
4.1.3 15 06/11/2023
4.1.2 15 06/11/2023
4.1.1 17 06/11/2023
4.1.0 20 06/11/2023
4.0.17 35 06/12/2024
4.0.16 27 05/22/2024
4.0.14 20 05/22/2024
4.0.13 18 06/14/2023
4.0.12 19 06/13/2023
4.0.11 20 06/12/2023
4.0.10 18 06/13/2023
4.0.9 16 06/10/2023
4.0.8 28 06/11/2023
4.0.7 32 03/28/2023
4.0.6 21 06/11/2023
4.0.5 19 06/11/2023
4.0.4 19 06/11/2023
4.0.3 18 06/11/2023
4.0.2 18 06/11/2023
4.0.1 19 06/11/2023
4.0.0 27 01/29/2020
4.0.0-rc1 14 08/22/2023
4.0.0-preview2 20 06/29/2024
4.0.0-preview1 23 02/15/2024
3.2.7 28 11/29/2019
3.2.6 48 06/12/2023
3.2.5 16 06/11/2023
3.2.4.1 23 08/21/2023
3.2.4 14 06/12/2023
3.2.3 17 06/12/2023
3.2.2 16 06/10/2023
3.2.1 43 06/01/2023
3.2.0 15 06/12/2023
3.1.10 16 06/12/2023
3.1.9 19 06/11/2023
3.1.8 21 06/11/2023
3.1.7 55 04/19/2023
3.1.6 22 06/11/2023
3.1.5 15 06/12/2023
3.1.4 18 06/12/2023
3.1.3 17 06/11/2023
3.1.2 17 06/12/2023
3.1.1 15 06/12/2023
3.1.0 19 06/11/2023
3.0.8 47 04/10/2023
3.0.7 18 06/12/2023
3.0.6 16 06/13/2023
3.0.5 19 06/11/2023
3.0.4 22 04/04/2023
3.0.3 62 03/26/2023
3.0.2 18 06/11/2023
3.0.1 16 06/12/2023
3.0.0 19 06/12/2023
2.2.7 18 06/11/2023
2.2.6 21 06/12/2023
2.2.5 17 06/12/2023
2.2.4.3 21 08/26/2023
2.2.4.1 18 08/22/2023
2.2.3 17 06/12/2023
2.2.2 15 06/11/2023
2.2.1 17 06/11/2023
2.2.0 22 06/11/2023
2.1.3 18 12/30/2023
2.1.2 42 05/03/2023
2.1.1 19 06/11/2023
2.1.0 18 06/11/2023
2.0.14.3 24 08/23/2023
2.0.12.1 49 03/30/2023
2.0.11 44 03/30/2023