#33655: Unnecessary column in a GROUP BY clause with QuerySet.exists()
-------------------------------------+-------------------------------------
     Reporter:  Marc Perrin          |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  4.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  exists group by      |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Marc Perrin):

 Thanks for the quick answer.

 Your suggested workaround seems interesting indeed (provided the value of
 said column does not affect the exists() return value - for example if
 it's 0?)

 NB: I didn't mean removing all constants from GROUP BY, rather: removing
 the automatic transmission of constants from the SELECT clause to the
 GROUP BY clause, since their meaning automatically switches from "constant
 number n" to "nth element of the select clause" which imo can never be
 intended.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33655#comment:2>
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/010701804c403f45-02daa392-4483-4b5a-8d7e-b240e4d38324-000000%40eu-central-1.amazonses.com.

Reply via email to