mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #29694 -- Fixed column mismatch crash with QuerySet.values() or values_list() after combining querysets with extra() with union(), difference(), or intersection().
Regression in 0b66c3b442
.
This commit is contained in:
parent
166dec8406
commit
39461a83c3
3 changed files with 17 additions and 1 deletions
|
@ -130,6 +130,13 @@ class QuerySetSetOperationTests(TestCase):
|
|||
).values_list('num', 'count')
|
||||
self.assertCountEqual(qs1.union(qs2), [(1, 0), (2, 1)])
|
||||
|
||||
def test_union_with_extra_and_values_list(self):
|
||||
qs1 = Number.objects.filter(num=1).extra(
|
||||
select={'count': 0},
|
||||
).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):
|
||||
ReservedName.objects.create(name='rn1', order=1)
|
||||
qs1 = Number.objects.annotate(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue