Fixed #34080 -- Fixed __exact lookup when nested arrays contain only NULL values.

Thanks jerch and David Sanders for reviews.
This commit is contained in:
Ion Alberdi 2022-10-09 11:01:14 +02:00 committed by Mariusz Felisiak
parent 34d63d5a41
commit 3dc9f3ac69
2 changed files with 28 additions and 1 deletions

View file

@ -253,6 +253,24 @@ class TestQuerying(PostgreSQLTestCase):
[obj],
)
def test_exact_null_only_nested_array(self):
obj1 = NullableIntegerArrayModel.objects.create(field_nested=[[None, None]])
obj2 = NullableIntegerArrayModel.objects.create(
field_nested=[[None, None], [None, None]],
)
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(
field_nested__exact=[[None, None]],
),
[obj1],
)
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(
field_nested__exact=[[None, None], [None, None]],
),
[obj2],
)
def test_exact_with_expression(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[Value(1)]),