Ver código fonte

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

Simon Charette 5 anos atrás
pai
commit
8b10357854
1 arquivos alterados com 5 adições e 4 exclusões
  1. 5 4
      django/db/models/expressions.py

+ 5 - 4
django/db/models/expressions.py

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