documentation: invalid foreign key and select_related
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Let's say Book has a foreign key to Author.
If there is a invalid id in the Author field of any Book instance, then these two queries get a different set
of Book instances:
The second query will omit the Book objects that have an author field that points nowhere.
This surprised me since I thought of select_related as only ADDING information to a query. In this situation it also REMOVES information.
Invalid keys can happen with a database that does not have referential integrity checking like mysql with MyISAM.