Menu

#247 dropTable creates extra connection when used in transaction

closed-fixed
General (125)
5
2009-04-17
2008-12-16
Iwan Vosloo
No

This has been tested with sqlobject (versions 0.9.1 or 0.10.2) and postgresql.
If you start a transaction, and then call dropTable on a class, that call creates an extra postgresql connection, outside of the transaction.

This is caused by the following line in dbconnection.py:
755 attr = getattr(self._dbConnection, attr)

which is called while self is still the Transaction, for attr
'server_version'.

This, however, returns the server_version method on the connection, bound to the _dbconnection the getattr was called on. This bound method gets called, and inside it self.queryOne is called:

304 server_version = self.queryOne("SELECT version()")[0]

This call creates the second connection.

Attached is a file demonstrating the issue, and a temporary workaround.

Discussion

  • Iwan Vosloo

    Iwan Vosloo - 2008-12-16

    Reproduce and show workaround

     
  • Oleg Broytman

    Oleg Broytman - 2009-04-17

    Fixed in the revisions 3853-3855 (branches 0.9, 0.10 and the trunk). Thank you!

     
  • Oleg Broytman

    Oleg Broytman - 2009-04-17
    • assigned_to: nobody --> phd
    • status: open --> closed-fixed
     

Log in to post a comment.