Opened 14 years ago

Closed 14 years ago

#13356 closed (duplicate)

EmptyResultSet when using annotation and empty filter

Reported by: Petr Marhoun <petr.marhoun@…> 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 Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Adam Nelson, 14 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12687

Note: See TracTickets for help on using tickets.
Back to Top