瀏覽代碼

Fixed #33713 -- Dropped support for MariaDB 10.3.

Mariusz Felisiak 2 年之前
父節點
當前提交
19297de2fe

+ 4 - 8
django/db/backends/mysql/features.py

@@ -52,17 +52,14 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     def minimum_database_version(self):
         if self.connection.mysql_is_mariadb:
-            return (10, 3)
+            return (10, 4)
         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,)
+        if not self.connection.mysql_is_mariadb and self.connection.mysql_version < (
+            8,
         ):
             return " FROM DUAL"
         return ""
@@ -254,8 +251,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     def can_introspect_check_constraints(self):
         if self.connection.mysql_is_mariadb:
-            version = self.connection.mysql_version
-            return version >= (10, 3, 10)
+            return True
         return self.connection.mysql_version >= (8, 0, 16)
 
     @cached_property

+ 4 - 3
django/db/backends/mysql/operations.py

@@ -441,7 +441,6 @@ class DatabaseOperations(BaseDatabaseOperations):
     def on_conflict_suffix_sql(self, fields, on_conflict, update_fields, unique_fields):
         if on_conflict == OnConflict.UPDATE:
             conflict_suffix_sql = "ON DUPLICATE KEY UPDATE %(fields)s"
-            field_sql = "%(field)s = VALUES(%(field)s)"
             # The use of VALUES() is deprecated in MySQL 8.0.20+. Instead, use
             # aliases for the new row and its columns available in MySQL
             # 8.0.19+.
@@ -449,8 +448,10 @@ class DatabaseOperations(BaseDatabaseOperations):
                 if self.connection.mysql_version >= (8, 0, 19):
                     conflict_suffix_sql = f"AS new {conflict_suffix_sql}"
                     field_sql = "%(field)s = new.%(field)s"
-            # VALUES() was renamed to VALUE() in MariaDB 10.3.3+.
-            elif self.connection.mysql_version >= (10, 3, 3):
+                else:
+                    field_sql = "%(field)s = VALUES(%(field)s)"
+            # Use VALUE() on MariaDB.
+            else:
                 field_sql = "%(field)s = VALUE(%(field)s)"
 
             fields = ", ".join(

+ 1 - 1
docs/ref/databases.txt

@@ -339,7 +339,7 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
 MariaDB notes
 =============
 
-Django supports MariaDB 10.3 and higher.
+Django supports MariaDB 10.4 and higher.
 
 To use MariaDB, use the MySQL backend, which is shared between the two. See the
 :ref:`MySQL notes <mysql-notes>` for more details.

+ 6 - 0
docs/releases/4.2.txt

@@ -223,6 +223,12 @@ backends.
 
 * ...
 
+Dropped support for MariaDB 10.3
+--------------------------------
+
+Upstream support for MariaDB 10.3 ends in May 2023. Django 4.2 supports MariaDB
+10.4 and higher.
+
 Miscellaneous
 -------------
 

+ 2 - 2
tests/backends/mysql/tests.py

@@ -107,8 +107,8 @@ class Tests(TestCase):
     @mock.patch.object(connection, "get_database_version")
     def test_check_database_version_supported(self, mocked_get_database_version):
         if connection.mysql_is_mariadb:
-            mocked_get_database_version.return_value = (10, 2)
-            msg = "MariaDB 10.3 or later is required (found 10.2)."
+            mocked_get_database_version.return_value = (10, 3)
+            msg = "MariaDB 10.4 or later is required (found 10.3)."
         else:
             mocked_get_database_version.return_value = (5, 6)
             msg = "MySQL 5.7 or later is required (found 5.6)."