summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/features.py
diff options
context:
space:
mode:
authorGagaro <gagaro42@gmail.com>2022-03-22 09:11:46 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-03-22 09:45:59 +0100
commit7325d291524827806feed271a077ea23e2b1b21f (patch)
treeac0e84fdb52a27c7795f88f70ef8fc9f71ebccbb /django/db/backends/mysql/features.py
parentf77216bd1a777e219aeada964c5af134f4112111 (diff)
downloaddjango-7325d291524827806feed271a077ea23e2b1b21f.tar.gz
Refs #30581 -- Fixed DatabaseFeatures.bare_select_suffix on MySQL < 8 and MariaDB < 10.4.
Diffstat (limited to 'django/db/backends/mysql/features.py')
-rw-r--r--django/db/backends/mysql/features.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py
index 357e431524..834ea4f88f 100644
--- a/django/db/backends/mysql/features.py
+++ b/django/db/backends/mysql/features.py
@@ -57,6 +57,17 @@ class DatabaseFeatures(BaseDatabaseFeatures):
return (5, 7)
@cached_property
+ def bare_select_suffix(self):
+ if (
+ self.connection.mysql_is_mariadb and self.connection.mysql_version < (10, 4)
+ ) or (
+ not self.connection.mysql_is_mariadb
+ and self.connection.mysql_version < (8,)
+ ):
+ return " FROM DUAL"
+ return ""
+
+ @cached_property
def test_collations(self):
charset = "utf8"
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= (