From 2a77850707db1dc71bd069be04b049cc52af8983 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 2 Mar 2007 21:22:14 +0000 Subject: - added "fold_equivalents" argument to Join.select(), which removes 'duplicate' columns from the resulting column clause that are known to be equivalent based on the join condition. this is of great usage when constructing subqueries of joins which Postgres complains about if duplicate column names are present. - added support to polymorphic stuff for more than one "equivalent column", when trying to target columns in the polymorphic union; this applies to multi-leveled inheritance - put above-two concepts together to get the abc_inheritance tests to work with postgres --- lib/sqlalchemy/sql_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql_util.py') diff --git a/lib/sqlalchemy/sql_util.py b/lib/sqlalchemy/sql_util.py index db3590cd8..3eb4b6d06 100644 --- a/lib/sqlalchemy/sql_util.py +++ b/lib/sqlalchemy/sql_util.py @@ -221,5 +221,8 @@ class ClauseAdapter(AbstractClauseProcessor): return None newcol = self.selectable.corresponding_column(col, raiseerr=False, keys_ok=False) if newcol is None and self.equivalents is not None and col in self.equivalents: - newcol = self.selectable.corresponding_column(self.equivalents[col], raiseerr=False, keys_ok=False) + for equiv in self.equivalents[col]: + newcol = self.selectable.corresponding_column(equiv, raiseerr=False, keys_ok=False) + if newcol: + return newcol return newcol -- cgit v1.2.1