]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixed union() bug whereby oid_column would not be available if no oid_column in embed...
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Apr 2008 16:06:58 +0000 (16:06 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Apr 2008 16:06:58 +0000 (16:06 +0000)
CHANGES
lib/sqlalchemy/sql/expression.py
test/sql/select.py

diff --git a/CHANGES b/CHANGES
index f66bc798cff9a5004a0e52c9ee90ad746a36a8f2..b0fbbc8012f76fa2fe80c5a58794c63c49ebad47 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,12 @@
 =======
 CHANGES
 =======
-
+0.4.6
+=====
+- sql
+    - Fixed bug with union() when applied to non-Table connected
+      select statements
+      
 0.4.5
 =====
 - orm
index 9272e6d82cdc2c1d3891657f4eaff8a1de48844e..2ed3b372f2843864b09ed46350f5be9900c8cf05 100644 (file)
@@ -2993,11 +2993,14 @@ class CompoundSelect(_SelectBaseMixin, FromClause):
                 self.selects.append(s)
 
         _SelectBaseMixin.__init__(self, **kwargs)
-
+        
+        self.oid_column = None
         for s in self.selects:
+            # TODO: need to repair proxy_column here to 
+            # not require full traversal
             if s.oid_column:
                 self.oid_column = self._proxy_column(s.oid_column)
-
+    
     def self_group(self, against=None):
         return _FromGrouping(self)
 
index 06679e9564b146564653f93d3d16129db36b5360..77926b421bed42ea8b0b27db8ea635d075d6ff23 100644 (file)
@@ -888,6 +888,13 @@ SELECT thirdtable.userid FROM thirdtable)"
             "SELECT myothertable.otherid FROM myothertable EXCEPT SELECT thirdtable.userid FROM thirdtable \
 UNION SELECT mytable.myid FROM mytable"
         )
+        
+        # test unions working with non-oid selectables
+        s = select([column('foo'), column('bar')])
+        s = union(s, s)
+        s = union(s, s)
+        self.assert_compile(s, "SELECT foo, bar UNION SELECT foo, bar UNION (SELECT foo, bar UNION SELECT foo, bar)")
+        
 
     @testing.uses_deprecated('//get_params')
     def test_binds(self):