Opened 8 years ago

Closed 7 years ago

#27964 closed Cleanup/optimization (fixed)

Raise an error if a MySQL geometry with an unsupported SRID is saved to the database

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: GIS Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

models.py:

class City(models.Model):
    point = models.PointField(srid=4326)

on PostGIS:

In [1]: from test_app.models import City
In [2]: from django.contrib.gis.geos import Point
In [3]: c = City.objects.create(point=Point(1, 1, srid=3857))
In [7]: c.refresh_from_db()
In [9]: print(c.point)
SRID=4326;POINT (8.983152841195214e-06 8.983152840993819e-06)

on MySQL:

In [1]: from test_app.models import City
In [2]: from django.contrib.gis.geos import Point
In [3]: c = City.objects.create(point=Point(1, 1, srid=3857))
In [4]: c.refresh_from_db()
In [5]: print(c.point)
SRID=4326;POINT (1 1)

I think that more appropriate behavior is to raise some error.

Change History (4)

comment:1 by Sergey Fedoseev, 8 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Tim Graham, 8 years ago

Summary: on MySQL geometry with other SRID is saved silently in DBRaise an error if a MySQL geometry with an unsupported SRID is saved to the database
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Probably a mention in the backwards incompatible changes section of the release notes would be a good idea.

comment:3 by Sergey Fedoseev, 7 years ago

Has patch: set

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 44a7b98a:

Fixed #27964 -- Made MySQL backend raise exception if spatial transformation is needed for query.

Note: See TracTickets for help on using tickets.
Back to Top