Queryset raising EmptyResultSet exception (instead of being empty)
|Reported by:||omat||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
EmptyResultSet exception is fired in 'in' lookups, if the lookup is against an empty ValuesListQuerySet.
>>> ids = Tag.objects.filter(id__in=).values_list(id, flat=True) >>> Tag.objects.filter(id__in=ids)
ids is an empty ValuesListQuerySet, as expected. The second line raises EmptyResultSet exception, where I would expect an empty QuerySet instead.
Change History (3)
comment:1 Changed 7 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 6 years ago by mtredinnick
- Summary changed from EmptyResultSet exception to Queryset raising EmptyResultSet exception (instead of being empty)