#26430: Coalesce in Aggregations ignored when EmptyResultSet returned
-------------------------------------+-------------------------------------
     Reporter:  ryanprater           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.9
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  aggregation          |             Triage Stage:
  coalesce in queryset               |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 Maybe we could somehow skip throwing EmptyResultSet when doing an
 .aggregate() call, but throw it when doing normal queries. One idea is to
 use query.add_context('in_aggregate_query', True), and then check
 compiler.query.context before throwing the EmptyResultSet.

 Another possible idea is to add as_python() methods to pretty much every
 part of the ORM. The as_python() method would run the expressions as
 Python code, so you could run whole querysets without actually touching
 the database. For the case where the query for .aggregate() generates an
 EmptyResultSet we would run the queryset in Python against one row having
 all None values, thus producing the wanted answer. This could be extremely
 convenient for testing, too. OTOH doing this properly will require at
 least a couple of months of work, so this is for sure overkill for this
 issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/26430#comment:4>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.577fae7402faf5c9d6bf177fcf3afbb9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to