diff options
| author | Simon Charette <charette.s@gmail.com> | 2025-04-02 13:32:38 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-04-03 20:40:43 +0200 |
| commit | f7f38f3a0b44d8c6d14344dae66b6ce52cd77b55 (patch) | |
| tree | 4d77579f310ae6334013563b69fe434467c4ef0a /tests/foreign_object/tests.py | |
| parent | 543e17c4405dfdac4f18759fc78b190406d14239 (diff) | |
Fixed #36290 -- Made TupleIn() lookup discard tuples containing None.
Just like the In() lookup discards of None members TupleIn() should
discard tuples containing any None as NULL != NULL in SQL and the
framework expects such queries to be elided under some circumstances.
Refs #31667, #36116.
Thanks Basptise Mispelon for bisecting the regression to 626d77e.
Diffstat (limited to 'tests/foreign_object/tests.py')
| -rw-r--r-- | tests/foreign_object/tests.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index de80c705ab..00b6a8350e 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -296,6 +296,19 @@ class MultiColumnFKTests(TestCase): self.assertEqual(friendships[0].to_friend, self.george) self.assertEqual(friendships[1].to_friend, self.sam) + def test_prefetch_foreignobject_null_hidden_forward_skipped(self): + fiendship = Friendship.objects.create( + from_friend_country=self.usa, + from_friend_id=self.bob.id, + to_friend_country_id=self.usa.id, + to_friend_id=None, + ) + with self.assertNumQueries(1): + self.assertEqual( + Friendship.objects.prefetch_related("to_friend").get(), + fiendship, + ) + def test_prefetch_foreignobject_reverse(self): Membership.objects.create( membership_country=self.usa, person=self.bob, group=self.cia |
