#28146: PostGIS: Django 1.11 adds two extra queries: SELECT
postgis_lib_version()
and SELECT version()
-------------------------------------+-------------------------------------
Reporter: George Tantiras | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by George Tantiras):
This is the result of bisect:
{{{
cbae4d31847d75d889815bfe7c04af035f45e28d is the first bad commit
}}}
models.py:
{{{
from django.contrib.gis.db import models
class TheModel(models.Model):
polygon_area = models.PolygonField()
centroid = models.PointField(srid=4326)
}}}
tests.py
{{{
from django.test import TestCase
from queries.models import TheModel
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.contrib.gis.db.models.functions import Distance
class ExcessQueriesTest(TestCase):
def setUp(self):
pass
def test_model(self):
with self.assertNumQueries(2):
print(
TheModel.objects.filter(
centroid__distance_lte=(Point(23.12, 37.9,srid=4326),
D(m=3000))
).annotate(
distance=Distance('centroid', Point(23.12,
37.9,srid=4326))
).order_by('polygon_area')
)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28146#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.897dff487ab1a9fa9707c1d7168b89d7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.