summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorbakabiko <ahmedabt@gmail.com>2018-05-19 01:37:36 +0200
committerTim Graham <timograham@gmail.com>2018-05-18 19:38:10 -0400
commit54b29e022d14c2fee34c01a41f016d531bef5057 (patch)
tree3c3f88275f53e94929cc7e7b0495c267f2a85384 /django
parent452abf7b43e4d93911e277976b87411bb4b2a52c (diff)
[2.1.x] Fixed #29380 -- Added support for QuerySet.select_for_update()'s nowait and skip_locked options on MySQL 8+.
Backport of a7bc1aea03508f544c9dfac0f34b01996653cef4 from master
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/mysql/features.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py
index 57f4c8ee76..56370bfcd9 100644
--- a/django/db/backends/mysql/features.py
+++ b/django/db/backends/mysql/features.py
@@ -10,7 +10,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
# MySQL doesn't support sliced subqueries with IN/ALL/ANY/SOME.
allow_sliced_subqueries_with_in = False
has_select_for_update = True
- has_select_for_update_nowait = False
supports_forward_references = False
supports_regex_backreferencing = False
supports_date_lookup_using_string = False
@@ -84,6 +83,12 @@ class DatabaseFeatures(BaseDatabaseFeatures):
return self.connection.mysql_version >= (8, 0, 2)
@cached_property
+ def has_select_for_update_skip_locked(self):
+ return self.connection.mysql_version >= (8, 0, 1)
+
+ has_select_for_update_nowait = has_select_for_update_skip_locked
+
+ @cached_property
def needs_explain_extended(self):
# EXTENDED is deprecated (and not required) in 5.7 and removed in 8.0.
return self.connection.mysql_version < (5, 7)