diff options
Diffstat (limited to 'django/db/models/sql/compiler.py')
-rw-r--r-- | django/db/models/sql/compiler.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index faa08e376d..1285b647d8 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -653,7 +653,12 @@ class SQLCompiler: params.extend(f_params) if self.query.select_for_update and features.has_select_for_update: - if self.connection.get_autocommit(): + if ( + self.connection.get_autocommit() + # Don't raise an exception when database doesn't + # support transactions, as it's a noop. + and features.supports_transactions + ): raise TransactionManagementError( "select_for_update cannot be used outside of a transaction." ) |