summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-05-18 08:38:08 +0200
committerGitHub <noreply@github.com>2022-05-18 08:38:08 +0200
commit19297de2fe5a9c47e471c64249366f39fe12f16a (patch)
tree207f9178810be4185758d9d90e81608f46cf9b25
parent2cec020f5bc462954d902bdad1a5955852cecff6 (diff)
Fixed #33713 -- Dropped support for MariaDB 10.3.
-rw-r--r--django/db/backends/mysql/features.py12
-rw-r--r--django/db/backends/mysql/operations.py7
-rw-r--r--docs/ref/databases.txt2
-rw-r--r--docs/releases/4.2.txt6
-rw-r--r--tests/backends/mysql/tests.py4
5 files changed, 17 insertions, 14 deletions
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 <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.
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)."