]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
tweak DISTINCT precedence for clauses like `func.count(t.c.col.distinct())`
authorJason Kirtland <jek@discorporate.us>
Thu, 9 Aug 2007 18:31:59 +0000 (18:31 +0000)
committerJason Kirtland <jek@discorporate.us>
Thu, 9 Aug 2007 18:31:59 +0000 (18:31 +0000)
CHANGES
lib/sqlalchemy/sql.py
test/sql/select.py

diff --git a/CHANGES b/CHANGES
index 3e4d174a6ea757d706a0d5301be44c046543b5b3..4a6868df706db007dab58cc3421966fe6eab471b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
 0.3.11
+- sql
+    - tweak DISTINCT precedence for clauses like
+      `func.count(t.c.col.distinct())`
 - orm
     - added a check for joining from A->B using join(), along two
       different m2m tables.  this raises an error in 0.3 but is 
index 8b454947efc1911f142e8fe0a54bd52ca5ae4aea..3233aad68fbf28e526f08868972e373332cdb9f7 100644 (file)
@@ -63,6 +63,7 @@ PRECEDENCE = {
     '>=':5,
     '<=':5,
     'BETWEEN':5,
+    'DISTINCT':5,
     'NOT':4,
     'AND':3,
     'OR':2,
index 4d3eb4ad70b682c1172563c73a4f739b37878176..030bf44dce0162d74591c27a525f54c74f122abe 100644 (file)
@@ -259,6 +259,14 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
         self.runtest(
             select([distinct(table1.c.myid)]), "SELECT DISTINCT mytable.myid FROM mytable"
         )
+
+        self.runtest(
+            select([func.count(table1.c.myid.distinct())]), "SELECT count(DISTINCT mytable.myid) FROM mytable" 
+        ) 
+
+        self.runtest(
+            select([func.count(distinct(table1.c.myid))]), "SELECT count(DISTINCT mytable.myid) FROM mytable" 
+        )
         
     def testoperators(self):
         self.runtest(