#10929: Support a default value for Sum (and possibly other aggregation 
functions)
-------------------------------------+-------------------------------------
     Reporter:  nolan                |                    Owner:
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  aggregate annotate   |      Needs documentation:  1
  default                            |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by jarshwah):

 I would support closing this as a duplicate of #23753. Once the linked
 ticket is implemented, it'll be possible for users to construct their own
 coalesce value like:

 {{{
 annotate(sum_field = Coalesce(Sum(...), 0))
 }}}

 This leaves the default behaviour alone, but provides a higher level of
 customisation. It relies on the #14030 patch which will also allow adding
 a "start" value, as mentioned by @lukeplant above:

 {{{
 annotate(sum_field = Coalesce(Sum(...), 0) + Value(5))
 }}}

 Would everyone be happy enough with the above use?

--
Ticket URL: <https://code.djangoproject.com/ticket/10929#comment:10>
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/063.91092bd01ff5b36e9770d4c523d072b4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to