Opened 7 years ago

Closed 7 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: UI/UX:


Here is the query:

bounds = Envelope( (ex_W, ex_N, ex_E, ex_S) ) # these are all floats

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:


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:
Installed Middleware:

File "/usr/lib/python2.6/dist-packages/django/core/handlers/" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/home/chris/Websites/jobmap/main/" in overlay_view
  202. 	ov.output().save(response, "PNG")
File "/home/chris/Websites/jobmap/main/" in output
  99. 		self.create_queryset(self.o)
File "/home/chris/Websites/jobmap/main/" in create_queryset
  150. 		if opbases:
File "/usr/lib/python2.6/dist-packages/django/db/models/" in __nonzero__
  112.             iter(self).next()
File "/usr/lib/python2.6/dist-packages/django/db/models/" in _result_iter
  106.                 self._fill_cache()
File "/usr/lib/python2.6/dist-packages/django/db/models/" in _fill_cache
  692.                     self._result_cache.append(
File "/usr/lib/python2.6/dist-packages/django/db/models/" in iterator
  238.         for row in self.query.results_iter():
File "/usr/lib/python2.6/dist-packages/django/db/models/sql/" in results_iter
  287.         for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.6/dist-packages/django/db/models/sql/" 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/" 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 Changed 7 years ago by anonymous

  • Component changed from Uncategorized to GIS
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by jbronn

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.

comment:3 Changed 7 years ago by anonymous

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 Changed 7 years ago by jbronn

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top