#24662: Sum() returns True/False when used with BooleanField & MySQL
-------------------------------------+-------------------------------------
     Reporter:  chriskief            |                    Owner:  marco-
                                     |  santamaria
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.8
  (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 jarshwah):

 Ooh you're right. I was incorrectly thinking that COUNT(0) would be 0, but
 it's 1. I don't mind the solution you've put forward because it's database
 agnostic and not at all dependent on the underlying storage mechanism. It
 will require the Sum aggregate to be a little more complicated though.
 Resolve Expression will need to inspect the output_type, and return a
 SumBoolean (or MinBoolean.. etc) which will have some small impact on non-
 boolean SUMs. Is this worth doing when users are able to create their own
 SumBoolean (or just use Count(Case(when..)) directly)?

--
Ticket URL: <https://code.djangoproject.com/ticket/24662#comment:9>
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/067.2e90b9fdf1f3f9c6fa02ef09b2fdd5c6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to