From bd74f81bb5b1158a1bc0a44e9990d4584380c481 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 13 Jan 2014 17:53:37 -0500 Subject: - Fixed a bug involving the new flattened JOIN structures which are used with :func:`.joinedload()` (thereby causing a regression in joined eager loading) as well as :func:`.aliased` in conjunction with the ``flat=True`` flag and joined-table inheritance; basically multiple joins across a "parent JOIN sub" entity using different paths to get to a target class wouldn't form the correct ON conditions. An adjustment / simplification made in the mechanics of figuring out the "left side" of the join in the case of an aliased, joined-inh class repairs the issue. [ticket:2908] --- lib/sqlalchemy/orm/relationships.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index 982f10a4d..6fdedd382 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -747,11 +747,10 @@ class RelationshipProperty(StrategizedProperty): return self.property.parent def _source_selectable(self): - elem = self.property.parent._with_polymorphic_selectable - if self.adapter: - return self.adapter(elem) + if self._adapt_to_entity: + return self._adapt_to_entity.selectable else: - return elem + return self.property.parent._with_polymorphic_selectable def __clause_element__(self): adapt_from = self._source_selectable() -- cgit v1.2.1