Opened 15 years ago
Closed 15 years ago
#11370 closed (invalid)
GeoQuery works fine in 1.0.2, but chokes on latest SVN
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here is the query:
bounds = Envelope( (ex_W, ex_N, ex_E, ex_S) ) # these are all floats Base.objects.filter(location__intersects=bounds.wkt)[:1000]
the actual query that gets executed is:
SELECT "main_opbase"."id", "main_opbase"."operation_id", "main_opbase"."base_id", "main_opbase"."workforce_size" FROM "main_opbase" WHERE "main_opbase"."base_id" IN (SELECT U0."identifier" FROM "main_base" U0 WHERE ST_Intersects("U0"."location", %s) LIMIT 1000)
here is the error output:
Environment: Request Method: GET Request URL: http://localhost:8000/overlay_5_4_12_DMB/ Django Version: 1.1 beta 1 SVN-10952 Python Version: 2.6.2 Installed Applications: ['main', 'django_extensions', 'django.contrib.comments', 'django.contrib.admindocs', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.gis', 'django.contrib.humanize', 'registration', 'debug_toolbar', 'django_authopenid'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django_authopenid.middleware.OpenIDMiddleware') Traceback: File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/home/chris/Websites/jobmap/main/overlays.py" in overlay_view 202. ov.output().save(response, "PNG") File "/home/chris/Websites/jobmap/main/overlays.py" in output 99. self.create_queryset(self.o) File "/home/chris/Websites/jobmap/main/overlays.py" in create_queryset 150. if opbases: File "/usr/lib/python2.6/dist-packages/django/db/models/query.py" in __nonzero__ 112. iter(self).next() File "/usr/lib/python2.6/dist-packages/django/db/models/query.py" in _result_iter 106. self._fill_cache() File "/usr/lib/python2.6/dist-packages/django/db/models/query.py" in _fill_cache 692. self._result_cache.append(self._iter.next()) File "/usr/lib/python2.6/dist-packages/django/db/models/query.py" in iterator 238. for row in self.query.results_iter(): File "/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py" in results_iter 287. for rows in self.execute_sql(MULTI): File "/usr/lib/python2.6/dist-packages/django/db/models/sql/query.py" in execute_sql 2369. cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django_debug_toolbar-0.7.0-py2.6.egg/debug_toolbar/panels/sql.py" in execute 44. return self.cursor.execute(sql, params) Exception Type: ProgrammingError at /overlay_5_4_12_DMB/ Exception Value: missing FROM-clause entry in subquery for table "U0" LINE 1: ...entifier" FROM "main_base" U0 WHERE ST_Intersects("U0"."loca...
I'm using postGIS. I don't normally post bugs, so if I left anything essential out, please let me know and I'll add whatever is needed.
Change History (4)
comment:1 by , 15 years ago
Component: | Uncategorized → GIS |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
Actually I just figured out what the problem was. It has to do with the way the new 1.1 deals with the {field}__in
in filters. Adding .values('pk')
fixed it.
comment:4 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I cannot reproduce. Please try to isolate your issue down to a simple reproducible test case, including models and data. If no more additional information is provided within a few weeks, I'll close this as
worksforme
.