From d5363fca5400f6c4969c2756fcfcdae6b9703091 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 7 Jun 2013 23:04:33 -0400 Subject: - Fixed an obscure bug where the wrong results would be fetched when joining/joinedloading across a many-to-many relationship to a single-table-inheriting subclass with a specific discriminator value, due to "secondary" rows that would come back. The "secondary" and right-side tables are now inner joined inside of parenthesis for all ORM joins on many-to-many relationships so that the left->right join can accurately filtered. [ticket:2369] --- lib/sqlalchemy/sql/util.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqlalchemy/sql/util.py') diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 4422705cd..bf3f3397e 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -213,6 +213,8 @@ def surface_selectables(clause): yield elem if isinstance(elem, expression.Join): stack.extend((elem.left, elem.right)) + elif isinstance(elem, expression.FromGrouping): + stack.append(elem.element) def selectables_overlap(left, right): """Return True if left/right have some overlapping selectable""" -- cgit v1.2.1