From 7325d291524827806feed271a077ea23e2b1b21f Mon Sep 17 00:00:00 2001 From: Gagaro Date: Tue, 22 Mar 2022 09:11:46 +0100 Subject: Refs #30581 -- Fixed DatabaseFeatures.bare_select_suffix on MySQL < 8 and MariaDB < 10.4. --- django/db/backends/mysql/features.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'django/db/backends/mysql/features.py') 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 @@ -56,6 +56,17 @@ class DatabaseFeatures(BaseDatabaseFeatures): else: 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" -- cgit v1.2.1