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
Npgsql.EntityFrameworkCore.PostgreSQL
Npgsql.EntityFrameworkCore.PostgreSQL
3,968
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
95
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
885
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
1,641
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
6,302
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
10,913
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
15,102
Npgsql.EntityFrameworkCore.PostgreSQL.Design
Npgsql.EntityFrameworkCore.PostgreSQL.Design
3,965
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
80
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
85
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
91
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
97
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
101
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
106
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
109
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
117
Npgsql.NetTopologySuite
NetTopologySuite plugin for Npgsql, allowing mapping of PostGIS geometry types to NetTopologySuite types.
124

Version Downloads Last updated
9.0.3 9 02/27/2025
9.0.2 14 12/13/2024
9.0.1 12 11/26/2024
9.0.0 12 12/14/2024
8.0.7 11 02/27/2025
8.0.6 11 11/26/2024
8.0.5 15 10/14/2024
8.0.4 16 09/11/2024
8.0.3 22 05/22/2024
8.0.2 27 02/16/2024
8.0.1 24 12/05/2023
8.0.0 23 11/21/2023
8.0.0-rc.2 23 10/13/2023
8.0.0-preview.4 32 05/31/2023
8.0.0-preview.3 52 05/09/2023
8.0.0-preview.2 43 04/04/2023
8.0.0-preview.1 33 04/04/2023
7.0.10 13 03/19/2025
7.0.9 12 11/26/2024
7.0.8 12 09/12/2024
7.0.7 16 05/22/2024
7.0.6 18 09/25/2023
7.0.4 32 06/07/2023
7.0.2 38 04/04/2023
7.0.1 30 01/15/2023
7.0.0 1,592 11/15/2022
7.0.0-rc.2 112 12/01/2022
7.0.0-rc.1 74 09/22/2022
7.0.0-preview.7 39 09/04/2022
7.0.0-preview.6 95 07/30/2022
7.0.0-preview.5 90 09/08/2022
7.0.0-preview.4 47 09/07/2022
7.0.0-preview.3 31 09/08/2022
7.0.0-preview.2 78 09/02/2022
7.0.0-preview.1 27 09/07/2022
6.0.13 14 11/26/2024
6.0.12 19 09/11/2024
6.0.11 19 05/22/2024
6.0.10 20 09/27/2023
6.0.9 34 04/04/2023
6.0.8 6,299 01/15/2023
6.0.7 14,446 09/21/2022
6.0.6 78 09/03/2022
6.0.5 37 08/21/2022
6.0.4 70 08/25/2022
6.0.3 178 06/28/2022
6.0.2 45 09/02/2022
6.0.1 77 08/21/2022
6.0.0 53 09/03/2022
6.0.0-rc.2 101 08/25/2022
6.0.0-rc.1 49 08/23/2022
6.0.0-preview7 42 09/05/2022
6.0.0-preview6 69 08/24/2022
6.0.0-preview5 46 08/04/2022
6.0.0-preview4 58 08/24/2022
6.0.0-preview3 25 08/22/2022
6.0.0-preview2 70 08/25/2022
5.0.18 18 05/22/2024
5.0.17 18 09/23/2023
5.0.16 48 04/04/2023
5.0.15 48 09/22/2022
5.0.14 85 08/24/2022
5.0.13 25 09/08/2022
5.0.12 58 09/02/2022
5.0.11 30 09/02/2022
5.0.10 10,823 06/27/2022
5.0.7 28 09/09/2022
5.0.5 63 09/07/2022
5.0.4 69 08/23/2022
5.0.3 58 09/03/2022
5.0.2 31 09/09/2022
5.0.1.1 67 09/08/2022
5.0.0 86 08/02/2022
4.1.14 22 05/22/2024
4.1.13 23 05/15/2024
4.1.12 37 08/23/2022
4.1.11 39 09/09/2022
4.1.10 51 08/27/2022
4.1.9 44 09/10/2022
4.1.8 90 08/22/2022
4.1.7 39 09/02/2022
4.1.6 30 09/07/2022
4.1.5 66 09/08/2022
4.1.4 50 09/03/2022
4.1.3.1 25 09/07/2022
4.1.3 99 09/09/2022
4.1.2 50 09/09/2022
4.1.1 88 09/03/2022
4.1.0 64 08/26/2022
4.0.17 15 06/10/2024
4.0.16 18 05/22/2024
4.0.14 20 05/22/2024
4.0.13 49 08/23/2022
4.0.12 56 09/09/2022
4.0.11 44 09/02/2022
4.0.10 80 09/09/2022
4.0.9 41 09/02/2022
4.0.8 31 08/21/2022
4.0.7 59 09/03/2022
4.0.6 36 09/02/2022
4.0.5 41 08/22/2022
4.0.4 35 09/02/2022
4.0.3 83 09/07/2022
4.0.2 83 09/09/2022
4.0.1 95 09/02/2022
4.0.0 92 08/20/2022
4.0.0-rc1 27 09/07/2022
4.0.0-preview2 42 08/24/2022
4.0.0-preview1 41 09/02/2022
3.2.7 38 06/29/2022
3.2.6 43 07/02/2022
3.2.5 64 09/07/2022
3.2.4.1 26 07/31/2022
3.2.4 41 08/22/2022
3.2.3 54 07/05/2022
3.2.2 29 08/24/2022
3.2.1 45 09/08/2022
3.2.0 104 09/02/2022
3.1.10 80 09/07/2022
3.1.9 3,959 06/27/2022
3.1.8 28 09/08/2022
3.1.7 45 08/15/2022
3.1.6 32 09/04/2022
3.1.5 36 09/06/2022
3.1.4 22 09/08/2022
3.1.3 55 07/31/2022
3.1.2 86 09/08/2022
3.1.1 94 08/23/2022
3.1.0 89 08/23/2022
3.0.8 40 09/08/2022
3.0.7 73 08/24/2022
3.0.6 96 07/31/2022
3.0.5 28 09/03/2022
3.0.4 37 07/11/2022
3.0.3 47 08/21/2022
3.0.2 74 09/07/2022
3.0.1 42 08/26/2022
3.0.0 30 08/22/2022
2.2.7 83 09/02/2022
2.2.6 26 07/01/2022
2.2.5 28 08/27/2022
2.2.4.3 38 08/24/2022
2.2.4.1 38 09/09/2022
2.2.3 46 09/08/2022
2.2.2 52 09/09/2022
2.2.1 28 08/21/2022
2.2.0 46 08/22/2022
2.1.3 37 09/08/2022
2.1.2 73 07/13/2022
2.1.1 53 08/24/2022
2.1.0 123 09/10/2022
2.0.14.3 63 09/02/2022
2.0.12.1 36 08/24/2022
2.0.11 66 08/26/2022