#30188: Aggregate annotation, Case() - When(): AssertionError No exception 
message
supplied
-------------------------------------+-------------------------------------
     Reporter:  Lukas Klement        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  query, aggregate,    |             Triage Stage:  Accepted
  case/when                          |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 I agree with Lukas that we should investigate why the ORM crashes here as
 it's a completely valid query from my perspective.

 The fundamental issue here is that `Subquery` breaks the `Expression` API
 by having a `get_source_expressions` method that returns `N > 0`
 expressions while having a `set_source_expressions` that accepts none.

 I happen to have a local branch I've been playing with locally to make
 `Subquery` more a of dumb wrapper around `sql.Query` that happens to
 restore this contract. I haven't tried it out against this exact set of
 models but the fact the caller
 
[https://github.com/django/django/blob/b435f82939edf70674856e0e1cd63973c2e0a1d1/django/db/models/sql/query.py#L362-L389
 hosts a FIXME] makes me feel like there might be something else going on.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30188#comment:14>
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/070.3fb2f8adcae430f6996f5a58bd402ce2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to