#32089: prefetch_related_objects() does not work for reused model instances.
-------------------------------------+-------------------------------------
     Reporter:  Dennis Kliban        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

 I had a brief look at fixing this. I think it's possible by filtering the
 objects before trying to prefetch for them. See
 
https://github.com/adamchainz/django/commit/bc2991c0908abbf4973cbb4850ffff0dea4bbd6f
 . This currently fails three prefetch tests - one for executing an extra
 query, two for executing one fewer query (which may actually represent a
 true optimization).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32089#comment:7>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.908686d0609b5c46bdc94a01aeb4655c%40djangoproject.com.

Reply via email to