#34972: Aggregate with CombinedExpression resulting in NotImplemented instead of
None after update from 3.2 -> 4.2
-------------------------------------+-------------------------------------
Reporter: ElRoberto538 | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) | Resolution:
Severity: Normal | worksforme
Keywords: CombinedExpression, | Triage Stage:
NotImplemented, aggregate | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
I think the issue is slightly more complicated than setting
`empty_result_set_value = None` as I would expect
{{{#!python
OurModel.objects.none().aggregate(random_aggregate=Count('field_2')/Count('field_2'))['random_aggregate']
}}}
To return `{"random_aggregate": 0}`.
The fact `NotImplemented` is returned here is problematic though and I
assume you have some third party apps that interacts with query
compilation in a way that does not account for the fact that an aggregate
that doesn't implement `empty_result_set_value` from an empty query should
be evaluated by the database.
--
Ticket URL: <https://code.djangoproject.com/ticket/34972#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/0107018bdbf1bde3-c59da091-c539-4fbf-be19-5d944a3b745f-000000%40eu-central-1.amazonses.com.