Opened 16 years ago
Closed 15 years ago
#13356 closed (duplicate)
EmptyResultSet when using annotation and empty filter
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Following code works :
from django.contrib.auth.models import User from django.db.models import Count User.objects.filter(id__in=[]).annotate(Count('groups')) [] User.objects.filter(id__in=[]).count() 0
But following code raise EmptyResultSet:
User.objects.filter(id__in=[]).annotate(Count('groups')).count()
(I don't know what is right - Error or empty response. But it is sure that current state is inconsistent.)
Change History (2)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 15 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #12687