#13442: only() and defer() will always select id
--------------------------------------+-------------------------------------
          Reporter:  mampf            |         Owner:     
            Status:  closed           |     Milestone:     
         Component:  ORM aggregation  |       Version:  1.1
        Resolution:  invalid          |      Keywords:     
             Stage:  Unreviewed       |     Has_patch:  0  
        Needs_docs:  0                |   Needs_tests:  0  
Needs_better_patch:  0                |  
--------------------------------------+-------------------------------------
Comment (by lukeplant):

 Replying to [comment:2 mampf]:
 > Hi lukeplant,
 >
 > thanks for your answer. Here are some additional thoughts.
 >
 > I used this document:
 http://docs.djangoproject.com/en/dev/ref/models/querysets/#defer-fields
 > It doesn't state that that the primary key an never be deferred.


 You need to read it again :-)


 > > only() is about only retrieving certain fields of objects
 > I thought I was doing this. But how useful is distinct when I need raw
 SQL to make it useful anyway? I see no usecase for that. The docs say:
 > > However, if your query spans multiple tables, it's possible to get
 duplicate results when a QuerySet is evaluated. That's when you'd use
 distinct().
 > If I span over multiple tables, I always get ids as seen above. This is
 why I will never have an use case for distinct() then.


 The use case for distinct is, as stated, to eliminate '''duplicate'''
 results (which will have the same id).

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13442#comment:3>
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