#28293 closed Bug (fixed)
QuerySet.union(QuerySet.none()) results in an empty queryset, should be the original queryset
Description ¶
Tested on Django 1.11.2.
As QuerySet.union()
uses the SQL UNION
operator, I would expect "SET1 UNION <EMPTY SET>" to result in SET1. Currently it results in the empty set.
>>> from django.contrib.auth.models import User >>> User.objects.count() 100 >>> list(User.objects.all().union(User.objects.none())) []
From https://www.postgresql.org/docs/current/static/queries-union.html
UNION effectively appends the result of query2 to the result of query1 ...
QuerySet.difference()
looks to suffer from the same issue.
Change History (5)
comment:1 by , 8 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
Marking as Release blocker since it's a bug in a newly introduced feature.