#13710: raw() sql bug when using joins
---------------------------------------------------+------------------------
          Reporter:  Renskers                      |         Owner:  nobody     
  
            Status:  new                           |     Milestone:             
  
         Component:  Database layer (models, ORM)  |       Version:  1.2        
  
        Resolution:                                |      Keywords:  raw sql 
joins
             Stage:  Unreviewed                    |     Has_patch:  0          
  
        Needs_docs:  0                             |   Needs_tests:  0          
  
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by Renskers):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I found the source of the problem. My model has a lot of fields, and most
 of them have long, verbose names.

 The error is caused in django/db/models/query_utils.py, on line 267:
 name = "%s_Deferred_%s" % (model.__name__, '_'.join(sorted(list(attrs))))

 This results in a *very* long string, which cannot be handled, or so it
 seems.

 When I change this line to something like this, it does work:
 name = "%s_Deferred_%s" % (model.__name__, '_lala')

 It's weird that this problem only presents itself when you don't use
 model.*. When using model.* in the raw query, everything works fine.

 This also fixes bug #13712.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13710#comment:1>
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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to