From 47d3f45d583ce82e5c6f967e580716cbb8e1791b Mon Sep 17 00:00:00 2001 From: Ants Aasma Date: Mon, 8 Oct 2007 15:25:51 +0000 Subject: - fix multiple consequent two phase transactions not working with postgres. For some reason implicit transactions are not enough. [ticket:810] - add an option to scoped session mapper extension to not automatically save new objects to session. --- lib/sqlalchemy/databases/postgres.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/databases/postgres.py') diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 74b9e6f43..345893524 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -306,6 +306,9 @@ class PGDialect(default.DefaultDialect): return sqltypes.adapt_type(typeobj, colspecs) def do_begin_twophase(self, connection, xid): + # Two phase transactions seem to require that the transaction is explicitly started. + # The implicit transactions that usually work aren't enough. + connection.execute(sql.text("BEGIN")) self.do_begin(connection.connection) def do_prepare_twophase(self, connection, xid): -- cgit v1.2.1