Skip to main content

Npgsql 2.2.0 final release is out!

This is Npgsql 2.2.0 Final Release

This release contains 249 commits since the last stable release. Includes bug fixes, improvements and new features.

Update notice: If you have been using Npgsql 2.2.0-rc2, you don't need to update to this version. They are the same except for the Assembly version information.

Major highlights

Visual Studio DDEX support


Kenji Uno added support for DDEX. Now you can use Npgsql with Visual Studio data designer. This is a missing feature a lot of our users requested in the past. Kenji added a tutorial about how to use Npgsql with DDEX. You can find it here:


Entity Framework


David Karlaš added support for EFMigration and Database creation in EF6+.
Now it is possible to start Code First projects without needing to create a database upfront. EntityFramework and Npgsql will take care of it.

Emil Lenngren added support for a lot of missing features of EntityFramework.

A list containing fixes from David and Emil as well as others for EntityFramework can be seen here:


SSLStream support


In this release, SSLStream is on by default.
If you want to use Mono.Security, you will need to use the following line in your code:
NpgsqlConnection.UseSslStream = false; 
Note that in future releases, this option may not be available anymore as we are removing the dependency on Mono.Security assembly. Let us know in the forums if you have any problem with ssl when using SSLStream. This will help us check if we will be able to remove Mono.Security assembly.


Added support for JSON, JSONB and HSTORE datatypes

Shay added support for those datatypes.


Added GSSAPI support on Windows

Brian Crowell added support for GSSAPI on windows. Now it is easier to use Active Directory when authenticating users.


Removed support for protocol v2

Postgresql versions which use only protocol 2 are very old and don't receive support from postgresql group anymore. By removing support for protocol version 2, we removed a lot of code and can focus on functionalities provided by protocol 3.


Removed support for Postgresql 8.4 and below

In this thread, we talked about making Npgsql support the officially supported postgresql versions. we talked about making Npgsql support the officially supported postgresql versions. Postgresql has a table of officially supported versions and we decided to follow this table to guide us which postgresql version we will have support to.
This doesn't necessarily mean that Npgsql won't work on unsupported versions. It may work if we don't add any SQL or unsupported feature. For example, today Npgsql 2.2 works only on Postgresql 8.2 and above because we added server side support for command timeout handling and some other queries which aren't supported on earlier versions.
If you are using earlier postgresql versions, please, use an older version of Npgsql. We are creating a compatibility table to show which Postgresql version Npgsql works with.


Fixed bugs:

[#91] Support for EFMigration and Database creation
[#152] NpgsqlInterval different constructors different ToString
[#158] NpgsqlCommand.Dispose() should execute "DEALLOCATE " for a prepared command
[#177] XML data type doesn't seem to be quoting parameters properly on insert
[#179] NpgsqlCommandBuilder automatic sql commands configuration
[#188] Buffer too small problem in NpgsqlCopySerializer
[#201] Dynamic type parameters: Cannot cast System.Int32 into any valid DbType after upgrading from to
[#208] ObjectDisposeException
[#217] Impossible to insert a Double.NaN value
[#219] [#1011005] using 2 NpgsqlCopyIn at the same time
[#223] HasRows property's bug
[#231] NpgsqlParameterCollection.Clear() doesn't reset NpgsqlParameter.Collection
[#225] Handle IEnumerable parameter
[#233] Cannot insert to tables which have only one column
[#246] Take followed by Skip is generated incorrectly in Entity Framework
[#262] FirstOrDefault() on navigation property subquery throws “Not Implemented” Exception
[#264] Mono.Security is outdated
[#269] Fix 's' value mapped to the 'a' byte
[#280] Bad SQL produced when selecting a field that was also used in the orderBy of a let subquery
[#287] Fix operator handling and date functions for EF
[#296] parameter parsing fails (regression) and duplicate [#240] NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe
[#315] Fix query parameter processing to more correctly match PostgreSQL's lexer
A list of the issues and pull requests merged for this release can be found at github here:


Known Issues

There are some issues we are working for the next maintenance release 2.2.1. You can check which issues we are working on here:



I'd like to give a special thanks to Kenji Uno for his excellent work with Npgsql DDEX support. DDEX support was one of the biggest missing features of Npgsql.
I'd like to thank Emil Lenngren for all his work with Entity Framework improvements and insightful comments, David Karlaš for his help with Entity Framework support. Shay Rojansky, Glen Parker and Josh Cooley for all contributions and comments, and a big thanks to all the other contributors who helped us to make this release.



Downloads are available on Nuget, github and pgfoundry.
Please, give it a try and let us know what you think. Drop by our user forums to discuss or send your bug reports to our issues section on github.


 List of contributors for this release

Kenji Uno
Shay Rojansky
Glen Parker
Emil Lenngren
David Karlaš
Brian Crowell
Tuan Nguyen
Frans Bouma
Jaspalsinh Chauhan
Josh Cooley
Martin Willey
Francisco Figueiredo Jr.
Javier Torres
Kevin Pullin
Michael de Lang
Oskar Gewalli
Sunny Ahuwanya
Thomas Radioyes


Piotr Trychta said…
Is support for ASP.NET Identity?
SHIMA91 said…
This comment has been removed by the author.
SHIMA91 said…
How use Code First with mvc 4

Install EntityFramewor 6.1.1, Npgsql, Npgsql EntityFramewor.

I created simple Single Page Application but the database is not created.

Web.config the same

What am I doing wrong
Unknown said…
This comment has been removed by the author.
Unknown said…
This comment has been removed by the author.
Unknown said…

When you use postgres with no access to postgres db (my host dont give me access) the entityframewok cannot apply updates (code first) to db beacause required permissions do postres DB. Debuging Npgsql I found the problem at NpgsqlServices at UsingPostgresDBConnection Method.

This occurs because postegres can connect first in postresDB, after in my DB, but this behavior was wrong.

I rebuild your dlls without Database change and works, but not create database, but its fine to me.

My email is

Thanks, regards.
Jools said…
Same as Daniel, the
really bugs me when access rights are denied to postgres database

Unfortunately this is 100% sure in my scenarios!
Unknown said…

I have the solution if you want.
Contact by email.

This comment has been removed by the author.

you have done a great job with Npgsql and we are using it for 3 years.

But now we are getting

ERROR: 08P01: invalid message format

with character containing \0.

I'am using parameters for execution of sql statement.

Npgsql Version with Postgres 9.4.1 x64

Can you help us?
Chang bui thi said…
Posts shared useful information and meaningful life, I'm glad to be reading this article and hope to soon learn the next article. thank you
i like play games friv 4 online and play games 2 girls 2 Download facebook movel
games unblocked said…
Great info. I love all the posts, I really enjoyed, I would like more information about this, because it is very nice., Thanks for sharing.
The place to play all unblocked games online. Here you can find every blocked games such as: unblockedgames , unblocked games happy , unblocked games 77 ,
great article, I was very impressed about it, wish you would have stayed next share
facebook iniciar sesion gratis - Sitio Oficial iniciado sesión en Facebook lengua española. facebook inicio sesion entrar rápido, facebook iniciar sesion en tu cuenta de entrar facebook
tranbaongoc said…
Thanks for sharing the information. It is very useful for my future. keep sharing
Games for girls|
Kizi 1|
Kizi 2
I wish you much fun with my comments, perhaps this blog will be a great blog someday I hope, I really liked this part of the article, with a big and interesting topic has helped a lot of people who don't oppose things that people should know, thanks a lot.
happy wheels
super mario bros
pubsquash John said…
Hello! I just want to offer you a huge thumbs up for the excellent info you have right here on this post. I'll be returning to your blog for more soon.
Kizi 123|
Friv 234|
bibikafu said…
Thanks for your great article friend, i get new information, new ideas to do somethings, i hope you will share again, i keep waiting for next post, thanks.
Kizi 3
Friv 4
tran thieugia said…
I like the flash and free games. Here is one of my favorite games today.
Friv 10
XUKA said…
Thank you for sharing a great information and useful. it really necessary and timely for me at this time. I wanted to share this information with my friends on the social network facebook.!
Friv 10000
An Giang said…
I like you and free games. Here is one of my favorite games today.
Friv 1
Online Game said…
You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks you for sharing!
Friv Games
tranbaongoc said…
You are stressed and tired, you need entertainment. Refer to our website. hope you get the most comfortable.
Kizi 4
Hieu Nguyen said…
you'd have time to look these kids active. Please visit our website and let us play the game interesting.
Thanks for sharing !
Friv 10
Kizi 10
Yepi 2
Le Bens said…
What a wonderfull post! thank you... read with pleasure!
Friv 100
Hieu Nguyen said…
You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks for sharing !
Friv 5
Kizi 1
Yepi 3
tranthuphuong said…
thank you for your interest in welcome visit
Friv 4
tranduyphong said…

New attractive game . I will play it every day
Friv 2
Anonymous said…
To flee war, to protect the lives of themselves and their families.
Mario | Friv | Doraemon Games | Kizi | Yoob Juegos
Hieu Nguyen said…
When you're tired, you want to relax after a stressful working hours, you need to have time to take care of the kids active.
Please visit our website and play exciting flash games.
Thanks you for sharing!
Friv 4
Anonymous said…
Mario | Mario Games: best Super Mario games and top Super Mario Bros games for you. Go now
Ki Moon said…
What a wonderfull post! thank you... read with pleasure!
Friv 2016
Kizi200 Games said…
Play the Best Free Games! We've picked out the racing games, cooking games, candy crush, games shooting, fashion games, ...
Thanks for sharing !
Kizi 200
Friv 1
Games are games of human intelligence.
Join experienced talent with me yet! What are you waiting for?
age of war 2
gold Miner 2
unfair Mario 2
cubefield 2
tanki Online 2

Friv Games
Friv 200

Popular posts from this blog

Using SSL Client Certificates with Npgsql

Hi all!

Recently, Jarrod Kinsley asked on our Forums how to establish an SSL connection. As Laurenz Albe pointed out, normally you just need to change your connection string to put "SSL=True;Sslmode=Require;" in your connection string and "ssl=on" in postgresql.conf and you are ready to go.

The problem was that this works in the general case where you don't have to deal with client certificates and other stuff. Npgsql has a lot of callbacks to help you to validate and talk to the server.

The last callback added to the chain by Frank Bollack was to provide a way to pass client certificates to server.

Later on the thread, Jennifer Marienfeld was also trying to connect and was stuck in the client certificate part. Jennifer eventually got success to establish connection to the server and I decided to create this post to show the code so others can benefit from this.

Here is Jennifer's code so you all can use as a template:

using System;
using System.IO;
using System.Se…

Npgsql Tips: Using " in (...)" queries with parameters list and "any" operator

Hi, all!

We have received some users questions about how to send a list of values to be used in queries using the "in" operator. Something like:

select foo, bar from table where foo in (blah1, blah2, blah3);

Npgsql supports array-like parameter values and the first idea to have this working would try to use it directly:

NpgsqlCommand command = new NpgsqlCommand("select * from tablee where field_serial in (:parameterlist)", conn);

ArrayList l = new ArrayList();

command.Parameters.Add(new NpgsqlParameter("parameterlist", NpgsqlDbType.Array | NpgsqlDbType.Integer));

command.Parameters[0].Value = l.ToArray();

NpgsqlDataReader dr = command.ExecuteReader();

but unfortunately this won't work as expected. Npgsql will send a query like this:

select * from tablee where field_serial in ((array[5,6])::int4[])

And Postgresql will complain with the following message:

ERROR: operator does not exist: integer …

Npgsql2 housekeeping

Hi all,

After 2 weeks without being able to play very much with computers due to my RSI problems, I'm finally getting back to normal work. Of course, under a much less workload... :)

Today, I did some housekeeping in Npgsql2 project. I fixed file which wasn't compiling due to some missing files. Now it is compiling very well with NAnt. Just call nant and it will compile a nice assembly Npgsql.dll for you. I also added MonoDevelop project files and also fixed Npgsql2 version in AssemblyInfo.cs file.

That's it!

I hope to be able to release a preview of Npgsql2 really soon. Stay tuned!