#24912: prefetch_related fails with sqlite3 database and UUIDField primary keys
-------------------------------------+-------------------------------------
Reporter: brki | Owner: zedr
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: UUIDField | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by brki):
Not sure what happened, I thought I'd posted this here already:
This seems to fix the issue for me, what do you think:
https://github.com/brki/django/commit/deec2487609c211f2225bf3b415a574c540bea7e
I've adapted the test a bit locally, too:
{{{
# This test passes if the target database is Postgresql, but fails for
sqlite3:
def test_prefetch_related(self):
with self.assertNumQueries(2):
players =
list(Player.objects.filter(id=self.player_id).prefetch_related('awards'))
with self.assertNumQueries(0):
player = players[0]
self.assertEqual(2, len(player.awards.all()))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24912#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.657c7f24c6f3ac00377fffb33a98bbbe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.