diff options
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/_functions.py | 6 | ||||
| -rw-r--r-- | django/db/backends/sqlite3/features.py | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/django/db/backends/sqlite3/_functions.py b/django/db/backends/sqlite3/_functions.py index 6d07d3d78b..b38e06eec2 100644 --- a/django/db/backends/sqlite3/_functions.py +++ b/django/db/backends/sqlite3/_functions.py @@ -80,6 +80,7 @@ def register(connection): connection.create_aggregate("STDDEV_SAMP", 1, StdDevSamp) connection.create_aggregate("VAR_POP", 1, VarPop) connection.create_aggregate("VAR_SAMP", 1, VarSamp) + connection.create_aggregate("ANY_VALUE", 1, AnyValue) # Some math functions are enabled by default in SQLite 3.35+. sql = "select sqlite_compileoption_used('ENABLE_MATH_FUNCTIONS')" if not connection.execute(sql).fetchone()[0]: @@ -513,3 +514,8 @@ class VarPop(ListAggregate): class VarSamp(ListAggregate): finalize = statistics.variance + + +class AnyValue(ListAggregate): + def finalize(self): + return self[0] diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index 1e995a87c0..8604adf40a 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -36,6 +36,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_aggregate_filter_clause = True supports_aggregate_order_by_clause = Database.sqlite_version_info >= (3, 44, 0) supports_aggregate_distinct_multiple_argument = False + supports_any_value = True order_by_nulls_first = True supports_json_field_contains = False supports_update_conflicts = True |
