Posts Tagged ‘unit testing’

Postgres, ResultSets and Concurrency

Monday, February 15th, 2010

I thought I had found a concurrency bug in PostgreSQL because a ResultSet that was local to a method was being closed by activity occurring in a different thread.

Then I read: “Once you make another query with the Statement used to create a ResultSet, the currently open ResultSet instance is closed automatically.” on http://jdbc.postgresql.org/documentation/84/resultset.html

Which means that I will have to make my code slightly less concurrent to work around that :-(.

I suspect it prevents bad coders from causing resource leaks though. So it is probably a good design decision.

This is why your unit tests should check for concurrency flaws :-).