#11370: GeoQuery works fine in 1.0.2, but chokes on latest SVN
---------------------------+------------------------------------------------
 Reporter:  anonymous      |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.0       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11370>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to