summaryrefslogtreecommitdiff
path: root/tests/queries/test_qs_combinators.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2018-08-29 10:00:15 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2018-08-29 10:03:36 +0200
commite7acd99113dfedee1bfcdadd2f81db96ab01e95d (patch)
treee03260835d32d176f06857c87e6d903bc137ea99 /tests/queries/test_qs_combinators.py
parentc4559d0b39087e82a546c16e7412a7c097787bf0 (diff)
[2.1.x] Fixed #29694 -- Fixed column mismatch crash with QuerySet.values() or values_list() after combining querysets with extra() with union(), difference(), or intersection().
Regression in 0b66c3b442875627fa6daef4ac1e90900d74290b. Backport of 39461a83c33f0cfe719d3b139413d1f5d1e75d5e from master
Diffstat (limited to 'tests/queries/test_qs_combinators.py')
-rw-r--r--tests/queries/test_qs_combinators.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
index 8b02ab308b..f1785dd783 100644
--- a/tests/queries/test_qs_combinators.py
+++ b/tests/queries/test_qs_combinators.py
@@ -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(