#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 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.
> 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.
Thanks for your answer. It made some thinks about how the orm works a
little clearer to me.
--
Ticket URL: <http://code.djangoproject.com/ticket/13442#comment:2>
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.