From: Mike Bayer Date: Thu, 7 Jun 2007 03:02:03 +0000 (+0000) Subject: extra test for corresponding column fix X-Git-Tag: rel_0_3_9~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf8d8436ec81a1aa5ad35b849285966753cfe629;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git extra test for corresponding column fix --- diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 3a8a27d67e..41b61d4afb 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1734,6 +1734,8 @@ class FromClause(Selectable): for co in self._adjusted_exportable_columns(): cp = self._proxy_column(co) for ci in cp.orig_set: + # note that some ambiguity is raised here, whereby a selectable might have more than + # one column that maps to an "original" column. examples include unions and joins self._orig_cols[ci] = cp if self.oid_column is not None: for ci in self.oid_column.orig_set: diff --git a/test/sql/selectable.py b/test/sql/selectable.py index 221d8430c4..57ad998860 100755 --- a/test/sql/selectable.py +++ b/test/sql/selectable.py @@ -27,6 +27,11 @@ table2 = Table('table2', db, ) class SelectableTest(testbase.AssertMixin): + def testjoinagainstself(self): + jj = select([table.c.col1.label('bar_col1')]) + jjj = join(table, jj, table.c.col1==jj.c.bar_col1) + assert jjj.corresponding_column(jjj.c.table1_col1) is jjj.c.table1_col1 + def testjoinagainstjoin(self): j = outerjoin(table, table2, table.c.col1==table2.c.col2) jj = select([ table.c.col1.label('bar_col1')],from_obj=[j]).alias('foo')