diff --git a/django/contrib/gis/db/backends/mysql/introspection.py b/django/contrib/gis/db/backends/mysql/introspection.py index 3dc4ae6488..7c1fb1ed84 100644 --- a/django/contrib/gis/db/backends/mysql/introspection.py +++ b/django/contrib/gis/db/backends/mysql/introspection.py @@ -29,10 +29,10 @@ class MySQLIntrospection(DatabaseIntrospection): return field_type, field_params 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) if storage_engine == 'InnoDB': - return self.connection.mysql_version >= ( - (10, 2, 2) if self.connection.mysql_is_mariadb else (5, 7, 5) - ) + if self.connection.mysql_is_mariadb: + True + return self.connection.mysql_version >= (5, 7, 5) return storage_engine in ('MyISAM', 'Aria') diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py index 3ca609f6c4..87ab371aa3 100644 --- a/django/contrib/gis/db/backends/mysql/operations.py +++ b/django/contrib/gis/db/backends/mysql/operations.py @@ -70,8 +70,6 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations): if self.connection.mysql_is_mariadb: unsupported.remove('PointOnSurface') unsupported.update({'GeoHash', 'IsValid'}) - if self.connection.mysql_version < (10, 2, 4): - unsupported.add('AsGeoJSON') elif self.connection.mysql_version < (5, 7, 5): unsupported.update({'AsGeoJSON', 'GeoHash', 'IsValid'}) return unsupported diff --git a/django/contrib/gis/db/backends/mysql/schema.py b/django/contrib/gis/db/backends/mysql/schema.py index 679b2bcb8e..01c66c8083 100644 --- a/django/contrib/gis/db/backends/mysql/schema.py +++ b/django/contrib/gis/db/backends/mysql/schema.py @@ -16,8 +16,8 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor): self.geometry_sql = [] def skip_default(self, field): - # Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13 and - # MariaDB < 10.2.1 don't support defaults. + # Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13 + # doesn't support defaults. if isinstance(field, GeometryField) and not self._supports_limited_data_type_defaults: return True return super().skip_default(field) diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 8b28a60485..d31594d584 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -132,8 +132,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): } # For these data types: - # - MySQL < 8.0.13 and MariaDB < 10.2.1 don't accept default values and - # implicitly treat them as nullable + # - MySQL < 8.0.13 doesn't accept default values and implicitly treats them + # as nullable # - all versions of MySQL and MariaDB don't support full width database # indexes _limited_data_types = ( diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index b51025e358..3b1b23a585 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -184,7 +184,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def supports_column_check_constraints(self): if self.connection.mysql_is_mariadb: - return self.connection.mysql_version >= (10, 2, 1) + return True return self.connection.mysql_version >= (8, 0, 16) supports_table_check_constraints = property(operator.attrgetter('supports_column_check_constraints')) @@ -193,7 +193,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): def can_introspect_check_constraints(self): if self.connection.mysql_is_mariadb: 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) @cached_property @@ -205,7 +205,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def has_select_for_update_nowait(self): if self.connection.mysql_is_mariadb: - return self.connection.mysql_version >= (10, 3, 0) + return True return self.connection.mysql_version >= (8, 0, 1) @cached_property @@ -244,7 +244,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def supports_json_field(self): if self.connection.mysql_is_mariadb: - return self.connection.mysql_version >= (10, 2, 7) + return True return self.connection.mysql_version >= (5, 7, 8) @cached_property diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index 6402bc7145..b45d3b8d98 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -77,10 +77,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): @property def _supports_limited_data_type_defaults(self): - # MariaDB >= 10.2.1 and MySQL >= 8.0.13 supports defaults for BLOB - # and TEXT. + # MariaDB and MySQL >= 8.0.13 support defaults for BLOB and TEXT. if self.connection.mysql_is_mariadb: - return self.connection.mysql_version >= (10, 2, 1) + return True return self.connection.mysql_version >= (8, 0, 13) def _column_default_sql(self, field): diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index 7b40058fe0..4cc9ceafd2 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -348,7 +348,7 @@ functions are available on each spatial backend. Function PostGIS Oracle MariaDB MySQL SpatiaLite ==================================== ======= ============== ============ =========== ================= :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:`AsKML` X X :class:`AsSVG` X X diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt index 82aaf1196d..ad1c02a588 100644 --- a/docs/ref/contrib/gis/functions.txt +++ b/docs/ref/contrib/gis/functions.txt @@ -52,7 +52,7 @@ geographic SRSes. .. class:: AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra) -*Availability*: MariaDB (≥ 10.2.4), `MySQL +*Availability*: MariaDB, `MySQL `__ (≥ 5.7.5), Oracle, `PostGIS `__, SpatiaLite diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index d78d2c97d3..acfed4866a 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -328,7 +328,7 @@ non-durable `_. 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 :ref:`MySQL notes ` for more details. @@ -683,7 +683,7 @@ a :exc:`~django.db.NotSupportedError` is raised. Option MariaDB MySQL =============== ========= ========== ``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) ``NO KEY`` =============== ========= ========== diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 3b20e9a595..73c0560374 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -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 ``None``. -``JSONField`` is supported on MariaDB 10.2.7+, MySQL 5.7.8+, Oracle, -PostgreSQL, and SQLite (with the :ref:`JSON1 extension enabled -`). +``JSONField`` is supported on MariaDB, MySQL 5.7.8+, Oracle, PostgreSQL, and +SQLite (with the :ref:`JSON1 extension enabled `). .. attribute:: JSONField.encoder diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 3a90eee179..f5bc3b8cb6 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1793,7 +1793,7 @@ them:: , ...]> 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 8.0.1+ supports the ``nowait``, ``skip_locked``, and ``of`` arguments. The ``no_key`` argument is only supported on PostgreSQL. diff --git a/docs/releases/4.1.txt b/docs/releases/4.1.txt index ee0a773f5d..28dd574af5 100644 --- a/docs/releases/4.1.txt +++ b/docs/releases/4.1.txt @@ -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 -------------