Rollback is called on Postgres DB when closing connection

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
marek.kulvejt
Posts: 5
Joined: Mon 06 Jul 2009 08:50

Rollback is called on Postgres DB when closing connection

Post by marek.kulvejt » Thu 30 Jul 2009 12:10

Hello,

we get 'NOTICE: there is no transaction in progress' message on the server when closing a connection that contained a transaction. Pseudo code:

using (PgSqlConnection conn = new PgSqlConnection(..))
{
conn.Open();

using (PgSqlTransaction trans = conn.BeginTransaction(...))
{
...execute command under the transaction

if (everythingWentOk)
{
trans.Commit();
}
else
{
trans.Rollback();
}
}
} // !!!! There is the problem here: when executing "conn.Close()", the DB server complains

When we call conn.Commit() the situation does not change.

What are we doing wrong? Is it a bug in the dotConnect driver?

Thanks in advance,
Marek Kulvejt

P.S. The data are stored well and everything seems to work. The problem is that we save a lot of data and we get approx. 1GB of log every day. Moreover, the database itself must do some work just to execute an useless command.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 31 Jul 2009 12:58

This is a designed behaviour. It is necessary to make rollback for the connection before placing it back to pool. As a workaround, you can turn off connection pooling (the Pooling=false; entry in the connection string).

Post Reply