Fixed #28900 -- Propagated all selected fields to combinator queries.

Previously, only the selected column aliases would be propagated and
annotations were ignored.
This commit is contained in:
Simon Charette 2023-03-30 01:23:12 -04:00 committed by Sarah Boyce
parent 65ad4ade74
commit 6d220963fa
3 changed files with 14 additions and 13 deletions

View file

@ -282,11 +282,7 @@ class QuerySetSetOperationTests(TestCase):
)
.values_list("num", "count")
)
qs2 = (
Number.objects.filter(num=2)
.extra(select={"count": 1})
.values_list("num", "count")
)
qs2 = Number.objects.filter(num=2).extra(select={"count": 1})
self.assertCountEqual(qs1.union(qs2), [(1, 0), (2, 1)])
def test_union_with_values_list_on_annotated_and_unannotated(self):