OpenGauss - the .NET data provider for PostgreSQL

stable next patch daily builds (vnext) build gitter

What is OpenGauss?

OpenGauss is the open source .NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using .NET.

For the full documentation, please visit the OpenGauss website. For the Entity Framework Core provider that works with this provider, see OpenGauss.EntityFrameworkCore.PostgreSQL.

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 OpenGaussConnection(connString);
await conn.OpenAsync();

// Insert some data
await using (var cmd = new OpenGaussCommand("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 OpenGaussCommand("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 OpenGauss.EntityFrameworkCore.PostgreSQL.

For the full documentation, please visit the OpenGauss website at https://www.opengauss.org.

TEST

TestUser

create user gaussdb with password '<YOUR_PASSWORD>' sysadmin;
create database dotnet_a DBCOMPATIBILITY='A';
create database dotnet_b DBCOMPATIBILITY='B';
create database dotnet_pg DBCOMPATIBILITY='PG';
\c dotnet_a;
create schema gaussdb;
\c dotnet_b
create schema gaussdb;
\c dotnet_pg
create schema gaussdb;

BUGTEST

Bug1645 -> OpenGauss.PostgresException : 42P07: relation "data" already exists Bug2278 -> OpenGauss.PostgresException : 0A000: DOMAIN is not yet supported. Bug2296 -> OpenGauss.PostgresException : 42P07: relation "data" already exists Bug3649 -> OpenGauss.PostgresException : 42601: syntax error at or near "binary"

Chunked_char_array_write_buffer_encoding_space -> OpenGauss.PostgresException : 42601: syntax error at or near "BINARY" Chunked_string_write_buffer_encoding_space -> OpenGauss.PostgresException : 42601: syntax error at or near "BINARY"

ConnectionTests

Connect_OptionsFromEnvironment_Succeeds -> SetEnvironmentVariable("PGOPTIONS", "-c default_transaction_isolation=serializable -c default_transaction_deferrable=on -c foo.bar=My"))

LargeObjectTests

OpenGauss.PostgresException : 0A000: openGauss does not support large object yet

TypeMapperTests

String_to_citext -> OpenGauss.PostgresException : 58P01: could not open extension control file: No such file or directory

StatementOID_legacy_batching -> CREATE TABLE ... WITH OIDS is not yet supported.

SchemaTests

Column_schema_data_types -> type line is not yet supported

MetaDataCollections -> type pg_node_tree is not yet supported.

Precision_and_scale -> type pg_node_tree is not yet supported

NodaTimeTests

Interval_as_Duration_with_months_fails -> function make_interval(months := integer) does not exist