Fixed #30860 -- Disabled unneeded NULLS FIRST/LAST workaround on SQLite 3.30+.

This commit is contained in:
Simon Charette 2019-10-09 04:47:49 -04:00 committed by Mariusz Felisiak
parent 94eae4e563
commit 8b10357854
1 changed files with 5 additions and 4 deletions

View File

@ -1146,10 +1146,11 @@ class OrderBy(BaseExpression):
def as_sqlite(self, compiler, connection): def as_sqlite(self, compiler, connection):
template = None template = None
if self.nulls_last: if connection.Database.sqlite_version_info < (3, 30, 0):
template = '%(expression)s IS NULL, %(expression)s %(ordering)s' if self.nulls_last:
elif self.nulls_first: template = '%(expression)s IS NULL, %(expression)s %(ordering)s'
template = '%(expression)s IS NOT NULL, %(expression)s %(ordering)s' elif self.nulls_first:
template = '%(expression)s IS NOT NULL, %(expression)s %(ordering)s'
return self.as_sql(compiler, connection, template=template) return self.as_sql(compiler, connection, template=template)
def as_mysql(self, compiler, connection): def as_mysql(self, compiler, connection):