#27985: Converting `Foo.objects.filter(bar=None)` to an `IsNull` too early. -------------------------------------+------------------------------------- Reporter: Jarek Glowacki | Owner: Sergey | Fedoseev Type: Bug | Status: closed Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: fixed Keywords: sql None NULL | Triage Stage: Accepted transform | Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Jon Dufresne): This change caused a regression for my project. Here is a simplified example: {{{ class Group(models.Model): pass class User(models.Model): groups = models.ManyToManyField('Group') class MyTest(TestCase): def test_unsaved(self): Group.objects.create() u = User() self.assertFalse(Group.objects.filter(user=u).exists()) }}} This test passes on 1.11 but fails on 2.0. On 1.11, passing an ''unsaved'' model to a M2M filter would result in an `INNER JOIN`. A bisect shows that since commit a5c60404476124c682c996bfb1eb077d59f1ec53, it now results in a `LEFT OUTER JOIN`. At this stage, only looking for clarification on what is correct to see if this change in behavior is intentional. Is this now correct as a `LEFT JOIN` or should this be considered a regression for this specific use? -- Ticket URL: <https://code.djangoproject.com/ticket/27985#comment:10> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.f0750dbc5c17df56617bc54c0d759dcc%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.