1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #34523 -- Fixed TransactionManagementError in QuerySet.update_or_create() with MyISAM storage engine.

QuerySet.update_or_create() uses nested atomic to handle possible
integrity errors taking savepoints as way to mark back the connection
as usable. Savepoints are not returned when
uses_savepoints/can_release_savepoints feature flags are set to False.
As a consequence, QuerySet.update_or_create() assumed the outer atomic
block is tainted and raised TransactionManagementError.

This commit partly reverts 331a460f8f.

Thanks gatello-s for the report.
This commit is contained in:
Mariusz Felisiak 2023-05-03 07:58:42 +02:00 committed by GitHub
parent ea53e7c09f
commit 83339d2103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,9 +297,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"""
return self._mysql_storage_engine != "MyISAM"
uses_savepoints = property(operator.attrgetter("supports_transactions"))
can_release_savepoints = property(operator.attrgetter("supports_transactions"))
@cached_property
def ignores_table_name_case(self):
return self.connection.mysql_server_data["lower_case_table_names"]