#11890: Defer/only + annotate is broken
---------------------------------------------------+------------------------
          Reporter:  [email protected]          |         Owner:  nobody
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  1.1   
        Resolution:                                |      Keywords:        
             Stage:  Unreviewed                    |     Has_patch:  1     
        Needs_docs:  0                             |   Needs_tests:  0     
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by [email protected]):

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

Comment:

 After a little more work, I had two more problems directly related to
 this.  The iterator method of  QuerySet and the results_iter method of
 Query seem to be calculating the index of the start of the
 aggregation_fields incorrectly when also using only/defer.  I am a little
 less certain of the solution I have working for this.

 I have attached the patch for Query because it is a little more involed.

 QuerySet iterator() defines aggregate_start on line 204:

 {{{aggregate_start = index_start + len(self.model._meta.fields)}}}

 I would propose to define it before the existing row 257 as:

 {{{aggregate_start = index_start + len(load_fields or
 self.model._meta.fields)}}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11890#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 [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