summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py3
1 files changed, 3 insertions, 0 deletions
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):