From 3dc9f3ac6960c83cd32058677eb0ddb5a5e5da43 Mon Sep 17 00:00:00 2001 From: Ion Alberdi Date: Sun, 9 Oct 2022 11:01:14 +0200 Subject: Fixed #34080 -- Fixed __exact lookup when nested arrays contain only NULL values. Thanks jerch and David Sanders for reviews. --- tests/postgres_tests/test_array.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/postgres_tests/test_array.py') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index fc4687b68c..89603e24a0 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -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)]), -- cgit v1.3