Skip to content

Commit c830a06

Browse files
author
Richard Jones
committed
handle postgresql bug in SQL generation [SF#984591]
1 parent d004ee8 commit c830a06

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Fixed:
2020
- rdbms backend full text search failure after import (sf bug 980314)
2121
- rdbms backends not filtering correctly on link=None
2222
- fix anydbm journal import (sf bug 983166)
23+
- handle postgresql bug in SQL generation (sf bug 984591)
2324

2425

2526
2004-06-24 0.7.5

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Alexander Smishlajev,
130130
Nathaniel Smith,
131131
Mitchell Surface,
132132
Mike Thompson,
133+
Martin Uzak,
133134
Darryl VanDorp,
134135
J Vickroy.
135136

roundup/backends/rdbms_common.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.118 2004-07-03 16:51:52 a1s Exp $
1+
# $Id: rdbms_common.py,v 1.119 2004-07-03 23:05:15 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -1992,7 +1992,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
19921992
timezone = self.db.getUserTimezone()
19931993

19941994
# vars to hold the components of the SQL statement
1995-
frum = ['_'+cn] # FROM clauses
1995+
frum = [] # FROM clauses
19961996
loj = [] # LEFT OUTER JOIN clauses
19971997
where = [] # WHERE clauses
19981998
args = [] # *any* positional arguments
@@ -2164,6 +2164,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
21642164
orderby.append(o)
21652165

21662166
# construct the SQL
2167+
frum.append('_'+cn)
21672168
frum = ','.join(frum)
21682169
if where:
21692170
where = ' where ' + (' and '.join(where))
@@ -2183,6 +2184,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
21832184
cols = ','.join(cols)
21842185
loj = ' '.join(loj)
21852186
sql = 'select %s from %s %s %s%s'%(cols, frum, loj, where, order)
2187+
print sql
21862188
args = tuple(args)
21872189
__traceback_info__ = (sql, args)
21882190
self.db.sql(sql, args)

test/db_test_base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: db_test_base.py,v 1.38 2004-07-03 22:43:59 richard Exp $
18+
# $Id: db_test_base.py,v 1.39 2004-07-03 23:05:15 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint
2121

@@ -836,15 +836,15 @@ def filteringSetup(self):
836836
iss = self.db.issue
837837
for issue in (
838838
{'title': 'issue one', 'status': '2', 'assignedto': '1',
839-
'foo': date.Interval('1:10'), 'priority': '1',
839+
'foo': date.Interval('1:10'), 'priority': '3',
840840
'deadline': date.Date('2003-01-01.00:00')},
841841
{'title': 'issue two', 'status': '1', 'assignedto': '2',
842842
'foo': date.Interval('1d'), 'priority': '3',
843843
'deadline': date.Date('2003-02-16.22:50')},
844844
{'title': 'issue three', 'status': '1', 'priority': '2',
845845
'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')},
846846
{'title': 'non four', 'status': '3',
847-
'foo': date.Interval('0:10'), 'priority': '1',
847+
'foo': date.Interval('0:10'), 'priority': '2',
848848
'nosy': ['1'], 'deadline': date.Date('2004-03-08')}):
849849
self.db.issue.create(**issue)
850850
file_content = ''.join([chr(i) for i in range(255)])
@@ -893,6 +893,8 @@ def testFilteringMultilink(self):
893893
ae, filt = self.filteringSetup()
894894
ae(filt(None, {'nosy': '2'}, ('+','id'), (None,None)), ['3'])
895895
ae(filt(None, {'nosy': '-1'}, ('+','id'), (None,None)), ['1', '2'])
896+
ae(filt(None, {'nosy': ['1','2']}, ('+', 'status'),
897+
('-', 'activity')), ['4', '3'])
896898

897899
def testFilteringMany(self):
898900
ae, filt = self.filteringSetup()

0 commit comments

Comments
 (0)