diff --git a/django/db/models/functions.py b/django/db/models/functions.py index 610ecb6985..613d396093 100644 --- a/django/db/models/functions.py +++ b/django/db/models/functions.py @@ -47,7 +47,9 @@ class ConcatPair(Func): return super(ConcatPair, self).as_sql(compiler, connection) def as_mysql(self, compiler, connection): - self.coalesce() + # Use CONCAT_WS with an empty separator so that NULLs are ignored. + self.function = 'CONCAT_WS' + self.template = "%(function)s('', %(expressions)s)" return super(ConcatPair, self).as_sql(compiler, connection) def coalesce(self):