Skip to main content

Npgsql 2.0.11 released!

As I've said in my last post,  Npgsql 2.0.11 is finally here!

This release fixes the problem with bytea handling with Postgresql 9.0. This patch should have been applied a long time ago. My fault for not being there yet.

Also on this release, Josh Cooley fixed some other bugs related to EF.

Checkout the release notes here for more info and download it from here.


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!