#31251: Unable to annotate a query that has an OuterRef already
-------------------------------------+-------------------------------------
     Reporter:  OJFord               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  db,outerref,group    |             Triage Stage:
  by,subquery,annotate               |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by OJFord):

 Perhaps I was doing something silly in the first place; I've resolved my
 issue by changing the subquery to first annotate (group by) all the
 `type`s, whatever they are, not `OuterRef`, and then only after the `Min`
 annotation `filter`ing on the `OuterRef("type")` matching the grouped by
 type.

 I'll leave this open for now though in case it's desired to improve the
 error message in this case, or perhaps there's a more sensibly-intentioned
 query that does produce the same error.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31251#comment:1>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.4297a207bf2e79656adacc1b8f6ca836%40djangoproject.com.

Reply via email to