﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33608	select_related() to nullable FK with db_constraint=False do not promote OUTER joins.	Mathieu Hinderyckx	nobody	"When using a FK which has db_constraint=False, the sql generated when using the combination of a filter() and select_related() are wrong, causing results which should be included in a queryset to not be.

The problem occurs when the remote object does not exist in the table where the FK points to. In some cases the ORM will generate an `INNER JOIN` statement instead of a `LEFT OUTER JOIN` causing a row to be wrongly omitted.

I have made a POC setup for this behaviour on https://github.com/mhindery/django_fk_issue, with testcases containing some working lookups, and one specific method that demonstrate the behaviour. I've included in comments in the tests the query which gets generated, showing the problematic join."	Bug	closed	Database layer (models, ORM)	3.2	Normal	invalid		Anssi Kääriäinen	Accepted	0	0	0	0	0	0
