ALTER DATABASE test SET default_text_search_config = 'pg_catalog.english'
+ For two-phase transaction support, the max_prepared_transactions
+ configuration variable must be set to a non-zero value in postgresql.conf.
+ See
+ https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS
+ for further background.
+
ORACLE: a user named "test_schema" is created in addition to the default
user.
from sqlalchemy import exc
from sqlalchemy import util
+from sqlalchemy.sql import text
from sqlalchemy.testing import exclusions
from sqlalchemy.testing.exclusions import against
from sqlalchemy.testing.exclusions import fails_if
from sqlalchemy.testing.exclusions import fails_on
from sqlalchemy.testing.exclusions import fails_on_everything_except
from sqlalchemy.testing.exclusions import LambdaPredicate
+from sqlalchemy.testing.exclusions import NotPredicate
from sqlalchemy.testing.exclusions import only_if
from sqlalchemy.testing.exclusions import only_on
from sqlalchemy.testing.exclusions import skip_if
def two_phase_transactions(self):
"""Target database must support two-phase transactions."""
+ def pg_prepared_transaction(config):
+ if not against(config, "postgresql"):
+ return False
+
+ with config.db.connect() as conn:
+ try:
+ num = conn.scalar(
+ text(
+ "select cast(setting AS integer) from pg_settings "
+ "where name = 'max_prepared_transactions'"
+ )
+ )
+ except exc.OperationalError:
+ return False
+ else:
+ return num > 0
+
return skip_if(
[
no_support("firebird", "no SA implementation"),
"recent MySQL communiity editions have too many issues "
"(late 2016), disabling for now",
),
+ NotPredicate(
+ LambdaPredicate(
+ pg_prepared_transaction,
+ "max_prepared_transactions not available or zero",
+ )
+ ),
]
)