mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #35088 -- Added support for Collect on MySQL 8.0.24+.
This commit is contained in:
@@ -31,6 +31,11 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
|
||||
def from_text(self):
|
||||
return self.geom_func_prefix + "GeomFromText"
|
||||
|
||||
@cached_property
|
||||
def collect(self):
|
||||
if self.connection.features.supports_collect_aggr:
|
||||
return self.geom_func_prefix + "Collect"
|
||||
|
||||
@cached_property
|
||||
def gis_operators(self):
|
||||
operators = {
|
||||
@@ -54,13 +59,18 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
|
||||
operators["relate"] = SpatialOperator(func="ST_Relate")
|
||||
return operators
|
||||
|
||||
disallowed_aggregates = (
|
||||
models.Collect,
|
||||
models.Extent,
|
||||
models.Extent3D,
|
||||
models.MakeLine,
|
||||
models.Union,
|
||||
)
|
||||
@cached_property
|
||||
def disallowed_aggregates(self):
|
||||
disallowed_aggregates = [
|
||||
models.Extent,
|
||||
models.Extent3D,
|
||||
models.MakeLine,
|
||||
models.Union,
|
||||
]
|
||||
is_mariadb = self.connection.mysql_is_mariadb
|
||||
if is_mariadb or self.connection.mysql_version < (8, 0, 24):
|
||||
disallowed_aggregates.insert(0, models.Collect)
|
||||
return tuple(disallowed_aggregates)
|
||||
|
||||
function_names = {
|
||||
"FromWKB": "ST_GeomFromWKB",
|
||||
@@ -128,3 +138,6 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
|
||||
return geom
|
||||
|
||||
return converter
|
||||
|
||||
def spatial_aggregate_name(self, agg_name):
|
||||
return getattr(self, agg_name.lower())
|
||||
|
||||
Reference in New Issue
Block a user