0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Refs #13312 -- Removed unnecessary IF wrapping in nulls_last handling on MySQL.

ISNULL function already returns 0 and 1 on MySQL.
This commit is contained in:
Simon Charette 2019-10-31 15:17:04 -04:00 committed by Mariusz Felisiak
parent a9bd01d363
commit a699595fce

View File

@ -1156,7 +1156,7 @@ class OrderBy(BaseExpression):
def as_mysql(self, compiler, connection):
template = None
if self.nulls_last:
template = 'IF(ISNULL(%(expression)s),1,0), %(expression)s %(ordering)s '
template = 'ISNULL(%(expression)s), %(expression)s %(ordering)s '
elif self.nulls_first:
template = 'IF(ISNULL(%(expression)s),0,1), %(expression)s %(ordering)s '
return self.as_sql(compiler, connection, template=template)