Skip to content

Commit 0fdc14f

Browse files
author
Richard Jones
committed
add sanity check for sort and group on same property [SF#1033477]
1 parent 6a7d4c5 commit 0fdc14f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Fixed:
4141
- mailgw can override the MAIL_DEFAULT_CLASS
4242
- handle Py2.3+ datetime objects as Date specs (sf bug 971300)
4343
- use row locking in MySQL newid() (sf bug 1034211)
44+
- add sanity check for sort and group on same property (sf bug 1033477)
4445

4546

4647
2004-07-21 0.7.6

roundup/backends/back_mysql.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,10 @@ def filter(self, search_matches, filterspec, sort=(None,None),
651651
where.append('_%s.id in (%s)'%(cn, s))
652652
args = args + v
653653

654+
# sanity check: sorting *and* grouping on the same property?
655+
if group[1] == sort[1]:
656+
sort = (None, None)
657+
654658
# "grouping" is just the first-order sorting in the SQL fetch
655659
orderby = []
656660
ordercols = []

roundup/backends/rdbms_common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.131 2004-09-26 14:38:54 a1s Exp $
1+
# $Id: rdbms_common.py,v 1.132 2004-10-07 06:08:42 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2154,6 +2154,10 @@ def filter(self, search_matches, filterspec, sort=(None,None),
21542154
where.append('_%s.id in (%s)'%(cn, s))
21552155
args = args + v
21562156

2157+
# sanity check: sorting *and* grouping on the same property?
2158+
if group[1] == sort[1]:
2159+
sort = (None, None)
2160+
21572161
# "grouping" is just the first-order sorting in the SQL fetch
21582162
orderby = []
21592163
ordercols = []

0 commit comments

Comments
 (0)