#272 sqlbuilder.Select.filter does not filter, just replaces

General (125)

def filter(self, filter_clause):
if filter_clause is None:
# None doesn't filter anything, it's just a no-op:
return self
clause = self.ops['clause']
if isinstance(clause, basestring):
clause = SQLConstant('(%s)' % clause)

if clause == SQLTrueClause: <---- always evaluates to true
newClause = filter_clause
newClause = AND(clause, filter_clause)
return self.newClause(newClause)

if clause == SQLTrueClause always evaluates to true so the clause is never ANDed just replaced which means filter is useless.
SQLExpression.__eq__ returns an SQLOp which evalutes to true.

Removing this conditional statement works as expected since ANDing with a true clause will work as one expects.


  • Oleg Broytman

    Oleg Broytman - 2012-06-22
    • assigned_to: nobody --> phd
  • Oleg Broytman

    Oleg Broytman - 2012-06-24
    • status: open --> closed-fixed
  • Oleg Broytman

    Oleg Broytman - 2012-06-24

    Fixed in the revisions 4545-4547 (branches 1.2, 1.3 and the trunk). Thank you!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks