Commit 61ea3718 authored by Josh Smeaton's avatar Josh Smeaton
Browse files

Refs #25517 -- Fixed backport inconsistencies.

parent 42e029f6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -339,6 +339,17 @@ class BaseExpression(object):
    def reverse_ordering(self):
        return self

    def flatten(self):
        """
        Recursively yield this expression and all subexpressions, in
        depth-first order.
        """
        yield self
        for expr in self.get_source_expressions():
            if expr:
                for inner_expr in expr.flatten():
                    yield inner_expr


class Expression(BaseExpression, Combinable):
    """
+2 −2
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ class ConcatPair(Func):
        return super(ConcatPair, coalesced).as_sql(compiler, connection)

    def as_mysql(self, compiler, connection):
        self.coalesce()
        return super(ConcatPair, self).as_sql(compiler, connection)
        coalesced = self.coalesce()
        return super(ConcatPair, coalesced).as_sql(compiler, connection)

    def coalesce(self):
        # null on either side results in null for expression, wrap with coalesce