Fixed #33713 -- Dropped support for MariaDB 10.3.

This commit is contained in:
Mariusz Felisiak 2022-05-18 08:38:08 +02:00 committed by GitHub
parent 2cec020f5b
commit 19297de2fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 14 deletions

View File

@ -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

View File

@ -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(

View File

@ -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.

View File

@ -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
-------------

View File

@ -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)."