#25095: Fields annotated for filtering which are not included in values are
included in GROUP BY clause in SQL
-------------------------------------+-------------------------------------
     Reporter:  mitchelljkotler      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jarshwah):

 The second test you added doesn't actually test what akaariai wants
 tested. I've made a comment on the new commit though, with a code example
 of what type of query needs to be tested. Hope that's clearer.

 Copying the test query below:

 {{{
 vals = list(
     Book.objects.annotate(xprice=F('price'))
             .filter(xprice__lte=30).values('publisher', 'xprice')  #
 xprice should now be in the group by clause
             .annotate(count=Count('pk')).values('publisher', 'count') #
 but xprice won't be in final select list returned
             .order_by('publisher'))
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25095#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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.06c86b9a7110a241e65b222649cd6f44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to