grant dba to scott;
+ Tests for two phase transactions require support for prepared transactions. To include them
+ the feature must be enabled by setting max_prepared_transactions to a value > 0.
+ See documentation for details
+ https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS
+
MSSQL: Tests that involve multiple connections require Snapshot Isolation
ability implemented on the test database in order to prevent deadlocks that
will occur with record locking isolation. This feature is only available
--- /dev/null
+.. change::
+ :tags: test, postgresql
+ :tickets: 5057
+
+ Improve detection of two phase transactions requirements by checking that
+ the database supports prepared transactions. This mainly affects postgresql
+ that has the feature disabled by default
+
def two_phase_transactions(self):
"""Target database must support two-phase transactions."""
+ def prepared_transaction(config):
+ from sqlalchemy import select, exc
+
+ with config.db.connect() as conn:
+ try:
+ trans = conn.begin_twophase()
+ conn.execute(select([1]))
+ trans.prepare()
+ trans.commit()
+ return True
+ except exc.OperationalError:
+ return False
+
return skip_if(
[
no_support("firebird", "no SA implementation"),
"(late 2016), disabling for now",
),
]
+ ) + only_if(
+ prepared_transaction, "missing support for prepared transaction"
)
@property