﻿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
11199	Select_related added to the query set will produce empty result	milosu	nobody	"You have a model like:
{{{
class Driver:
    name = models.CharField(max_length=100)

class Car:
    name = models.CharField(max_length=100)
    driver = models.ForeignKey(Driver)
}}}
Inside the database mangle the fkey from car to driver as nullable and insert some records into car table without the reference to the driver table.

Than just try:
{{{
Car.objects.filter(name = 'something').select_related()
}}}
and you will get empty queryset when evaluated.

I guess this is a correct ORM behaviour when using inner joins etc.

Could this be documented somewhere? It was quite mysterious for me to make an observation like this and to find the problem (missing null=True model declaration).."		closed	Database layer (models, ORM)	1.0		invalid			Unreviewed	0	0	0	0	0	0
