diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index 53c0652fce..5387dffb9c 100644 --- a/django/db/backends/mysql/features.py +++ b/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 diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py index 823090b9d1..7c4e21671b 100644 --- a/django/db/backends/mysql/operations.py +++ b/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( diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 1d4c14ab96..a80c10e8f6 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -339,7 +339,7 @@ non-durable `_. 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 ` for more details. diff --git a/docs/releases/4.2.txt b/docs/releases/4.2.txt index 0b698360fb..9c16ae870e 100644 --- a/docs/releases/4.2.txt +++ b/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 ------------- diff --git a/tests/backends/mysql/tests.py b/tests/backends/mysql/tests.py index 234b4df441..d02f465cbf 100644 --- a/tests/backends/mysql/tests.py +++ b/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)."