Skip to main content

Posts

Showing posts with the label postgresql

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 .

Npgsql bytea handling fix is coming...

Hi all! I'm aware of this problem and it is already fixed. We will be doing a new release on the next few days. For while, the current workaround is to fallback to previous handling style by changing postgresql.conf file. More info can be found here . Sorry for the problems this may have caused.

Npgsql 2.0.10 and NpgsqlParameter.Value

Hi all! As you may already know, Npgsql 2.0.10 is out . Besides the usual batch of bug fixes and enhancements, this release has a new feature which needs more attention as it may give you backward compatibility problems. What happened? With this release, we decided to implement a property in NpgsqlParameter which returns provider specific objects, just like SQLClient does. NpgsqlParameter now features a property called NpgsqlValue. As you may guess, when you use it, you will receive a value whose type is Npgsql specific. Why this change? In the past, we had a lot of problems dealing how we would handle values which are specific to Npgsql, like NpgsqlTimestamp from others which are represented in CLR, like DateTime. This situation led to cast exceptions bugs . This was the main motivation for this. Also, we think that by implementing this we would be giving our users a much consistent way of getting values in CLR type and in Npgsql-specific type. Another benefit is that now Npgsql can ...

Npgsql Connection Pool Explained

Hi all! From time to time, we receive some questions regarding connection pool in Npgsql and I think I should post some info about its current design. Npgsql connection pool implements the common pattern of having some connections open beforehand so when one is needed, it will be readily available for using. How it works When a application opens a connection, Npgsql tries to find a pool of connections based on the connection string. If a pool doesn't exist, it is created with a number of connections specified in the MinPoolSize connectionstring parameter. After that, a connection is retrieved from this pool. The min and max number of connections created in each pool is controlled by connection string parameters called MinPoolSize and MaxPoolSize respectively. This way, users can fine tune the pool behavior to match their scalability needs. Npgsql controls the lifetime of unused connections in the pool, trying to get connections number near the minimum value set by user. This is d...

Function call performance optimizations

On my last post about that subject , I wrote about some optimizations I did to get better performance when calling functions with Npgsql. While that optimizations were very nice, they had a drawback: you had to reuse your NpgsqlCommand object. You had to reuse it because the optimizations were based on cached data and if you created a new NpgsqlCommand object the data would need to be cached again. In the general case, where you would create many NpgsqlCommand objects and call functions with them, you would not benefit from those optimizations. In order to fix that, Noah Misch created a patch which remove 2 of the 3 internal calls which were giving performance problems. The only case left is for functions which have return type of 'record'. We are working to get this case also covered. I'm going to show here how much performance improvement you get with this patch with a simple call to a function which returns an integer. This function is on Npgsql unit test suite, but I ...

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; us...

SSL Renegotiation patch

Hi all! Albe Laurenz called my attention to a new patch applied to Postgresql servers which allows the administrator to set a value telling server when it will start SSL renegotiations. This parameter also allows you to disable the renegotiation.[1] Today, I committed a patch which tries to disable SSL Renegotiation on supported postgresql servers, which means, servers which had this patch applied. According to Albe those server versions are: 9.0, 8.4.3, 8.3.10, 8.2.16, 8.1.20, 8.0.24, 7.4.28. This patch simple calls: SET ssl_renegotiation_limit=0 as suggested by Albe. One positive side effect of this modification is that it serves as an workaround to SSL renegotiation problem with Npgsql. Today, Npgsql has problems with this, as can be seen on this bug report[2]. Although this patch isn't a solution, at least it makes Npgsql works on long SSL sessions. If you want to try it out now, please grab latest code from cvs and let us know if you got any problems on our forums: http://foru...

New "articles" section on our Forums

Hi all! I created an "articles" section on our forums so people can post links to Npgsql, .Net and/or Postgresql related articles which can benefit Npgsql users. This will help users to get a centralized point where they can find valuable information. Please, check it out here . Comments and, of course, links are very much welcome. UPDATE: Alaric Dailey was the first person to post a link to an article about .Net Data Providers. Please, check it out here

Better data type handling mechanism landed on cvs

Hi all! Yesterday, 2009-12-12, Josh Cooley committed a better datatype handling mechanism to Npgsql. This will allow Npgsql to be more consistent when handling types because it is now much better defined when to return specific (or provider specific) datatypes and when to return CLR datatypes. What does all this mean? Well, Npgsql now implements the methods DbDataReader.GetProviderSpecificValue() , DbDataReader.GetproviderSpecificValues() and GetProviderSpecificDataType() . With those methods implemented, users will have a defined way of getting the specific types provided by Npgsql. The other methods will now always return the CLR types. This modification will also enable Npgsql to work better with the ado.net library. For example, we have reports that NpgsqlInet data wasn't being rendered in a DataGrid . By inspecting the test case, the dataset was correctly filled, but Datagrid seemed to not like NpgsqlInet and didn't render its value. With this type handling modification...

Npgsql 2.0.7 released!

Hi all, Npgsql 2.0.7 is out. This is a minor bug fix release. The most notorious bug fix is one made by Josh Cooley about possible freezes and strange exceptions when canceling a query. So, if you were having any problem like this, please give it a try. Download it from: downloads.npgsql.org This is the release notes of this release: Bugs fixed: [#1010527] Fix query timeout connection corruption. [#1010700] Capture parameter names with NpgsqlCommandBuilder.DeriveParameters. Thanks Brian Schloz (bschloz @nospam@ hotmail.com) for patch. Also added nunit testcase. [#1010668] Npgsql ConnectionStringBuilder provides no connectionstring properties. Now Npgsql correctly reports default connectionstring properties. Thanks Alaric Dailey for heads up and patch! Fixed bug when trying to retrieve a date value with -infinity value. See more here: http://pgfoundry.org/forum/message.php?msg_id=1005249 Thanks Andrus Moor for bug report and test case and Laurenz Albe for repo...

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(); l.Add(5); l.Add(6); 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 followin...

Npgsql 2.0.5 released!

Hi, all! Npgsql Development Team released Npgsql 2.0.5. This is a bug fix release. And we fixed some important bugs. The first one is about the famous NotSupportedException seek operation. Npgsql now handles this by flushing the stream before writing to it. It is not the complete solution but it is an step in the right direction. Another bug which is open for quite some time is the return value of DataAdapter.Update. It wasn't working very well for multiple statements. Now it is working ok. Josh Cooley added a lot of fixes for Entity Framework and Transactions support. Please, check our release notes to see all the changes on this release. You can download this release on our usual location . Thanks everybody who helped us with comments, feedback and patches.

Did you like Npgsql? Send us a postcard!

Hi all! Some time ago, a friend of mine, Horita, told me about a project whose owner asked people who liked his software to send him a postcard. I liked the idea and yesterday, while cooking the 2.0.2 release with Josh Cooley, I told him about this idea and he also liked it. So, if you like Npgsql you can send us a postcard. Here are the addresses: Josh Cooley 102 Boston Harbour Way Madison, AL 35758 USA Francisco Figueiredo Jr. QMSW 05 Lote 02 Bloco C Apto 116 Sudoeste - Brasilia - DF - Brazil Zip Code: 70680-500 Thank you very much!

Npgsql 2.0.2 released!

Hi all! Npgsql Development Team is proud to announce we just released Npgsql 2.0.2! This release brings the usual bug fixes and minor improvements from previous release. Here are the release notes: Fixes: Fix the fix for datetime.MinValue and MaxValue. Only MinValue was fixed. Now both Min and Max are fixed. Thanks Andrus Moor for heads up.(fxjr) Fixed problem with parameter sizes and prepared statements.(fxjr) [#1010488] NgsqlParameter of type containing DBNull values throws NullReferenceException [#1010521] NpgsqlInterval should be quoted. Datetime with negative values (thanks to Mathieu Fenniak ) and singular values such as "1 day" [#1010495] Bad performance calling a (empty) function very often. New additions: Added documentation about how to use Npgsql with Provider Factory. Thanks Alaric for heads up. Ensure refcursors work with System.Transactions. (Josh) On this release, Josh Cooley fixed some bugs on Entity Framework support and System.Transactions. For mo...

NpgsqlCommand optimizations and usage tip

Hi, all! Some days ago, I fixed a slow performance problem with Npgsql when calling functions . The problem was that Npgsql was doing a lot of expensive checks (in fact, 3) to verify parameter information and return type. The solution was to cache those checks so that new calls to the same function don't need to pass through the same checks again. In order to not have problems with outdated caches and etc and after talking to Josh on gmail, I decided to make the cache local and it would be invalidated as soon as the command text is changed. This semantics lead me to write this blog to share the idea that you can get a big performance improvement if you "cache" your NpgsqlCommands which will be used with function calls. This way, instead of creating and releasing the command object after its usage, you can create all your NpgsqlCommand objects associated to function calls and reuse them as needed. This way you pay for the costly checks only once. I hope this tip can help ...

Npgsql2 2.0.1 released!

Hi, all! Npgsql Development Team has just released Npgsql2 2.0.1. This is a minor bug fix release with highlights to entity framework fixes. Check out release notes for more information. You can grab it from the usual location: http://downloads.npgsql.org Enjoy.

Npgsql2 Final Released!!

Hi, all! The Npgsql Development Team is proud to announce the Npgsql2 RTM! Npgsql is a .Net Data provider written 100% in C# which allows .net programs to talk to postgresql backends. Npgsql is licensed under BSD. More info can be obtained from http://www.npgsql.org After almost two years of development since Npgsql 1.0, Npgsql 2 brings new features and support for newer versions of .Net. Although externally Npgsql2 doesn't seem very different of Npgsql1 regarding features, internally Npgsql2 had a lot of improvements which represents a much more stable product, more bugs fixed and many implemented methods. It is strongly advised that current users update from Npgsql1 to Npgsql2. Main features are: Support for .Net 2.0 and 3.5 Josh Cooley did a great job and added support for EntityFramework. Npgsql2 now doesn't read all table contents before returning control to user code. This makes Npgsql much more memory efficient when dealing with large tables. Thanks Jon Hanna for this. C...

Npgsql2 RC2 Released!!

Hi all! It's a great pleasure to say that Npgsql2 RC2 is released. From release notes: This version contains some fixes and updates for latest entity framework release. We are already in feature freeze and not so many things were added this time. Highlights include: Npgsql2 rc2 now supports .NET 3.5 sp1 with Entity Framework support. We support model generation by the command line edmgen.exe tool. This requires the Npgsql be registered in the provider section of machine.config. A lot of fixes were done on connection pool handling. Also, when running under Mono, Npgsql wasn't using connection pool. Now it is. We added some code to better handle threadabort when executing queries with Npgsql. It isn't perfect but is much better than with previous versions. Grab it from http://downloads.npgsql.org Thank you everybody who helped with bug reports, comments and patches!

Npgsql2 RC1 Released!

Hi, all! It's a great pleasure to say Npgsql Development Team made a new release of Npgsql2. We are closer to the final release! On the highlights, thanks to Josh Cooley, we have support for newer version of EntityFramework 3.5sp1beta. Another highlight is that we fixed the cast problem some people had when using Npgsql2 beta4. Now, Npgsql will only use casts if the user explicitly specify a DbType or NpgsqlDbType value. Also, thanks Andreas Schönebeck, who provided us with testcases and feedback, we have a much better threadabortexception handling. Those exceptions were making Npgsql be instable and sometimes unusable. Please, if you had any problem, give RC1 a try and help us to improve Npgsql for final release. Other changes can be seen in our changelog . Donwload Npgsql2RC1 from our usual place Thank you to all who helped us with this release with feedback, bug fixes, bug reports and comments.