]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
extra test for corresponding column fix
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 7 Jun 2007 03:02:03 +0000 (03:02 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 7 Jun 2007 03:02:03 +0000 (03:02 +0000)
lib/sqlalchemy/sql.py
test/sql/selectable.py

index 3a8a27d67e408dba8e648ee2b5e57635e35448b0..41b61d4afb65985487d0d931ab4d2be616516d0e 100644 (file)
@@ -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:
index 221d8430c409522cfd23bbdb24defe2c729eae61..57ad998860d6441c2a1f3490b28232c2303be2af 100755 (executable)
@@ -27,6 +27,11 @@ table2 = Table('table2', db,
 )\r
 \r
 class SelectableTest(testbase.AssertMixin):\r
+    def testjoinagainstself(self):\r
+        jj = select([table.c.col1.label('bar_col1')])\r
+        jjj = join(table, jj, table.c.col1==jj.c.bar_col1)\r
+        assert jjj.corresponding_column(jjj.c.table1_col1) is jjj.c.table1_col1\r
+\r
     def testjoinagainstjoin(self):\r
         j  = outerjoin(table, table2, table.c.col1==table2.c.col2)\r
         jj = select([ table.c.col1.label('bar_col1')],from_obj=[j]).alias('foo')\r