From f47fec31f8b51ad8fdc0a5d6805d0130f8700ca8 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Mon, 31 Oct 2022 21:56:25 -0400 Subject: [PATCH] Refs #33768 -- Fixed ordering compound queries by NULLs on SQLite < 3.30. The lack of support for native nulls last/first on SQLite 3.28 and 3.29 requires the compound query to be wrapped for emulation layer to work properly. --- django/db/backends/sqlite3/features.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index 6e10e61572..9f6de827dd 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -41,6 +41,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_frame_range_fixed_distance = Database.sqlite_version_info >= (3, 28, 0) supports_aggregate_filter_clause = Database.sqlite_version_info >= (3, 30, 1) supports_order_by_nulls_modifier = Database.sqlite_version_info >= (3, 30, 0) + # NULLS LAST/FIRST emulation on < 3.30 requires subquery wrapping. + requires_compound_order_by_subquery = Database.sqlite_version_info < (3, 30) order_by_nulls_first = True supports_json_field_contains = False supports_update_conflicts = Database.sqlite_version_info >= (3, 24, 0)