]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- added **modifiers to _get_from_objects
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Aug 2007 17:53:01 +0000 (17:53 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Aug 2007 17:53:01 +0000 (17:53 +0000)
- fixed up PG distinct flag

lib/sqlalchemy/databases/postgres.py
lib/sqlalchemy/sql/expression.py

index 2a4d230cd582fe043e32fe0f89ab476a570d0753..e2876f1f80622d0442d68978855b1b33c1b552d6 100644 (file)
@@ -567,15 +567,14 @@ class PGCompiler(compiler.DefaultCompiler):
 
     def get_select_precolumns(self, select):
         if select._distinct:
-            if type(select._distinct) == bool:
+            if isinstance(select._distinct, bool):
                 return "DISTINCT "
-            if type(select._distinct) == list:
-                dist_set = "DISTINCT ON ("
-                for col in select._distinct:
-                    dist_set += self.strings[col] + ", "
-                    dist_set = dist_set[:-2] + ") "
-                return dist_set
-            return "DISTINCT ON (" + str(select._distinct) + ") "
+            elif isinstance(select._distinct, (list, tuple)):
+                return "DISTINCT ON (" + ', '.join(
+                    [(isinstance(col, basestring) and col or self.process(col)) for col in select._distinct]
+                )+ ") "
+            else:
+                return "DISTINCT ON (" + unicode(select._distinct) + ") "
         else:
             return ""
 
index 41f2b741bb1e56612429c1886f8d0bb7bb0d0f67..b31ccbe44edd0c1aa156757002662429e4c4bb4a 100644 (file)
@@ -2426,7 +2426,7 @@ class Alias(FromClause):
             yield c
         yield self.selectable
 
-    def _get_from_objects(self):
+    def _get_from_objects(self, **modifiers):
         return [self]
 
     bind = property(lambda s: s.selectable.bind)