#33608: select_related() to nullable FK with db_constraint=False do not promote OUTER joins. -------------------------------------+------------------------------------- Reporter: Mathieu Hinderyckx | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 3.2 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Simon Charette): The question here is should the ORM account for possible integrity violations in the first place, lets not forget that `db_constraint` was basically introduced as [https://github.com/django/django/commit/b55cde054ee7dd22f93c3522a8ddb1d04193bcac some form of shadow option] without in-dept discussion about its desired behaviour with regards to violations. How the ORM should account for possible integrity violation was already discussed in the past plenty when usage of the MySQL's MyISAM backend (and SQLite in older versions) which doesn't support foreign keys was more common and caused users to run into this exact issue. Given we've opted not to special case JOIN'ing logic for `supports_foreign_keys` in the past I don't see why we should take a different stance for `db_constraint=False`. If we allowed `Object.objects.filter(remote_object_id=1234).select_related('remote_object')` to return `Object` instances what would their `.remote_object` be? A mock `RemoteObject(id=1234)` object? Simply `None`? Aren't both approaches breaking symmetry with `Object.objects.filter(remote_object_id=1234).first().remote_object` raising a `RemoteObject.DoesNotExist` exception? -- Ticket URL: <https://code.djangoproject.com/ticket/33608#comment:3> 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107017fe0dd2165-23ea51a8-e8aa-4113-856a-6c7704e6a5e4-000000%40eu-central-1.amazonses.com.