diff options
| author | Simon Charette <charettes@users.noreply.github.com> | 2019-10-09 04:47:49 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-10-09 10:47:49 +0200 |
| commit | 8b10357854f6e21ffcfea6761d2375338088720e (patch) | |
| tree | 3e4a695b030b8d75f7c4d4dc6118070b373493a4 | |
| parent | 94eae4e5633fbf21f5dcae6e0472ce6a51dd3411 (diff) | |
Fixed #30860 -- Disabled unneeded NULLS FIRST/LAST workaround on SQLite 3.30+.
| -rw-r--r-- | django/db/models/expressions.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 5df765b626..2eae16541e 100644 --- a/django/db/models/expressions.py +++ b/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): |
