Optimize out JOIN for selectinload with many to one
The optimzation applied to selectin loading in :ticket:`4340` where a JOIN
is not needed to eagerly load related items is now applied to many-to-one
relationships as well, so that only the related table is queried for a
simple join condition. In this case, the related items are queried
based on the value of a foreign key column on the parent; if these columns
are deferred or otherwise not loaded on any of the parent objects in
the collection, the loader falls back to the JOIN method.
Fixes: #4775
Change-Id: I398e0d276789ce6e0019d213a37bdf99d24ec290
(cherry picked from commit
a5a66f1e580150a55a729e7b6dc804adb55b2f5c)