Fixed #33129 -- Dropped support for MariaDB 10.2.

This commit is contained in:
Mariusz Felisiak 2021-09-22 11:57:54 +02:00 committed by GitHub
parent 2f14432375
commit 221b2f85fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 25 deletions

View File

@ -29,10 +29,10 @@ class MySQLIntrospection(DatabaseIntrospection):
return field_type, field_params return field_type, field_params
def supports_spatial_index(self, cursor, table_name): def supports_spatial_index(self, cursor, table_name):
# Supported with MyISAM/Aria, or InnoDB on MySQL 5.7.5+/MariaDB 10.2.2+ # Supported with MyISAM/Aria, or InnoDB on MySQL 5.7.5+/MariaDB.
storage_engine = self.get_storage_engine(cursor, table_name) storage_engine = self.get_storage_engine(cursor, table_name)
if storage_engine == 'InnoDB': if storage_engine == 'InnoDB':
return self.connection.mysql_version >= ( if self.connection.mysql_is_mariadb:
(10, 2, 2) if self.connection.mysql_is_mariadb else (5, 7, 5) True
) return self.connection.mysql_version >= (5, 7, 5)
return storage_engine in ('MyISAM', 'Aria') return storage_engine in ('MyISAM', 'Aria')

View File

@ -70,8 +70,6 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
unsupported.remove('PointOnSurface') unsupported.remove('PointOnSurface')
unsupported.update({'GeoHash', 'IsValid'}) unsupported.update({'GeoHash', 'IsValid'})
if self.connection.mysql_version < (10, 2, 4):
unsupported.add('AsGeoJSON')
elif self.connection.mysql_version < (5, 7, 5): elif self.connection.mysql_version < (5, 7, 5):
unsupported.update({'AsGeoJSON', 'GeoHash', 'IsValid'}) unsupported.update({'AsGeoJSON', 'GeoHash', 'IsValid'})
return unsupported return unsupported

View File

@ -16,8 +16,8 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
self.geometry_sql = [] self.geometry_sql = []
def skip_default(self, field): def skip_default(self, field):
# Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13 and # Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13
# MariaDB < 10.2.1 don't support defaults. # doesn't support defaults.
if isinstance(field, GeometryField) and not self._supports_limited_data_type_defaults: if isinstance(field, GeometryField) and not self._supports_limited_data_type_defaults:
return True return True
return super().skip_default(field) return super().skip_default(field)

View File

@ -132,8 +132,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
} }
# For these data types: # For these data types:
# - MySQL < 8.0.13 and MariaDB < 10.2.1 don't accept default values and # - MySQL < 8.0.13 doesn't accept default values and implicitly treats them
# implicitly treat them as nullable # as nullable
# - all versions of MySQL and MariaDB don't support full width database # - all versions of MySQL and MariaDB don't support full width database
# indexes # indexes
_limited_data_types = ( _limited_data_types = (

View File

@ -184,7 +184,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property @cached_property
def supports_column_check_constraints(self): def supports_column_check_constraints(self):
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 2, 1) return True
return self.connection.mysql_version >= (8, 0, 16) return self.connection.mysql_version >= (8, 0, 16)
supports_table_check_constraints = property(operator.attrgetter('supports_column_check_constraints')) supports_table_check_constraints = property(operator.attrgetter('supports_column_check_constraints'))
@ -193,7 +193,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
def can_introspect_check_constraints(self): def can_introspect_check_constraints(self):
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
version = self.connection.mysql_version version = self.connection.mysql_version
return (version >= (10, 2, 22) and version < (10, 3)) or version >= (10, 3, 10) return version >= (10, 3, 10)
return self.connection.mysql_version >= (8, 0, 16) return self.connection.mysql_version >= (8, 0, 16)
@cached_property @cached_property
@ -205,7 +205,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property @cached_property
def has_select_for_update_nowait(self): def has_select_for_update_nowait(self):
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 3, 0) return True
return self.connection.mysql_version >= (8, 0, 1) return self.connection.mysql_version >= (8, 0, 1)
@cached_property @cached_property
@ -244,7 +244,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property @cached_property
def supports_json_field(self): def supports_json_field(self):
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 2, 7) return True
return self.connection.mysql_version >= (5, 7, 8) return self.connection.mysql_version >= (5, 7, 8)
@cached_property @cached_property

View File

@ -77,10 +77,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
@property @property
def _supports_limited_data_type_defaults(self): def _supports_limited_data_type_defaults(self):
# MariaDB >= 10.2.1 and MySQL >= 8.0.13 supports defaults for BLOB # MariaDB and MySQL >= 8.0.13 support defaults for BLOB and TEXT.
# and TEXT.
if self.connection.mysql_is_mariadb: if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 2, 1) return True
return self.connection.mysql_version >= (8, 0, 13) return self.connection.mysql_version >= (8, 0, 13)
def _column_default_sql(self, field): def _column_default_sql(self, field):

View File

@ -348,7 +348,7 @@ functions are available on each spatial backend.
Function PostGIS Oracle MariaDB MySQL SpatiaLite Function PostGIS Oracle MariaDB MySQL SpatiaLite
==================================== ======= ============== ============ =========== ================= ==================================== ======= ============== ============ =========== =================
:class:`Area` X X X X X :class:`Area` X X X X X
:class:`AsGeoJSON` X X X (≥ 10.2.4) X (≥ 5.7.5) X :class:`AsGeoJSON` X X X X (≥ 5.7.5) X
:class:`AsGML` X X X :class:`AsGML` X X X
:class:`AsKML` X X :class:`AsKML` X X
:class:`AsSVG` X X :class:`AsSVG` X X

View File

@ -52,7 +52,7 @@ geographic SRSes.
.. class:: AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra) .. class:: AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra)
*Availability*: MariaDB (≥ 10.2.4), `MySQL *Availability*: MariaDB, `MySQL
<https://dev.mysql.com/doc/refman/en/spatial-geojson-functions.html#function_st-asgeojson>`__ (≥ 5.7.5), <https://dev.mysql.com/doc/refman/en/spatial-geojson-functions.html#function_st-asgeojson>`__ (≥ 5.7.5),
Oracle, `PostGIS <https://postgis.net/docs/ST_AsGeoJSON.html>`__, SpatiaLite Oracle, `PostGIS <https://postgis.net/docs/ST_AsGeoJSON.html>`__, SpatiaLite

View File

@ -328,7 +328,7 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
MariaDB notes MariaDB notes
============= =============
Django supports MariaDB 10.2 and higher. Django supports MariaDB 10.3 and higher.
To use MariaDB, use the MySQL backend, which is shared between the two. See the To use MariaDB, use the MySQL backend, which is shared between the two. See the
:ref:`MySQL notes <mysql-notes>` for more details. :ref:`MySQL notes <mysql-notes>` for more details.
@ -683,7 +683,7 @@ a :exc:`~django.db.NotSupportedError` is raised.
Option MariaDB MySQL Option MariaDB MySQL
=============== ========= ========== =============== ========= ==========
``SKIP LOCKED`` X (≥10.6) X (≥8.0.1) ``SKIP LOCKED`` X (≥10.6) X (≥8.0.1)
``NOWAIT`` X (≥10.3) X (≥8.0.1) ``NOWAIT`` X X (≥8.0.1)
``OF`` X (≥8.0.1) ``OF`` X (≥8.0.1)
``NO KEY`` ``NO KEY``
=============== ========= ========== =============== ========= ==========

View File

@ -1196,9 +1196,8 @@ A field for storing JSON encoded data. In Python the data is represented in its
Python native format: dictionaries, lists, strings, numbers, booleans and Python native format: dictionaries, lists, strings, numbers, booleans and
``None``. ``None``.
``JSONField`` is supported on MariaDB 10.2.7+, MySQL 5.7.8+, Oracle, ``JSONField`` is supported on MariaDB, MySQL 5.7.8+, Oracle, PostgreSQL, and
PostgreSQL, and SQLite (with the :ref:`JSON1 extension enabled SQLite (with the :ref:`JSON1 extension enabled <sqlite-json1>`).
<sqlite-json1>`).
.. attribute:: JSONField.encoder .. attribute:: JSONField.encoder

View File

@ -1793,7 +1793,7 @@ them::
<QuerySet [<Person: ...)>, ...]> <QuerySet [<Person: ...)>, ...]>
The ``postgresql``, ``oracle``, and ``mysql`` database backends support The ``postgresql``, ``oracle``, and ``mysql`` database backends support
``select_for_update()``. However, MariaDB 10.3+ only supports the ``nowait`` ``select_for_update()``. However, MariaDB only supports the ``nowait``
argument, MariaDB 10.6+ also supports the ``skip_locked`` argument, and MySQL argument, MariaDB 10.6+ also supports the ``skip_locked`` argument, and MySQL
8.0.1+ supports the ``nowait``, ``skip_locked``, and ``of`` arguments. The 8.0.1+ supports the ``nowait``, ``skip_locked``, and ``of`` arguments. The
``no_key`` argument is only supported on PostgreSQL. ``no_key`` argument is only supported on PostgreSQL.

View File

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