Opened 7 years ago

Closed 7 years ago

#46 closed enhancement (fixed)

Two enhancements to the pgdbCnx class

Reported by: Peter Harris Owned by: D'Arcy J.M. Cain
Priority: major Milestone: 4.1
Component: DB API 2 Version: 4.0
Keywords: Cc:


  1. close() should ROLLBACK if there is a transaction underway. To preserve current behaviour, it should ignore any OperationalError? that results from attempting the ROLLBACK.

Reason: we've found that if you close a connection to pgbouncer with a
transaction open, it can't return the postgresql connection at its end
back to the connection pool immediately. This badly degrades performance
if you have a lot of short-duration connections from (for example) web services
funnelled through pgbouncer.

  1. connect() should be usable in a python "with" statement so it

auto-closes at the end of the block. This just needs enter and
exit methods, which will have no effect on code not using the
connection in a "with".

A patch is attached, svn diff from revision 427

Attachments (1)

conn_fixes.patch (878 bytes) - added by cito 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by cito

Attachment: conn_fixes.patch added

comment:1 Changed 7 years ago by cito

Implemented in r437 and r438.

comment:2 Changed 7 years ago by cito

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.