summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/_functions.py
diff options
context:
space:
mode:
authorontowhee <82607723+ontowhee@users.noreply.github.com>2025-03-15 19:23:28 -0700
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-05-20 10:01:42 +0200
commitddb85294159185c5bd5cae34c9ef735ff8409bfe (patch)
treeaf6266521ed95fffa1e497e0c6420b867a7df839 /django/db/backends/sqlite3/_functions.py
parentf603ece016352834829c84c157cc6dbf93c8d8d5 (diff)
Fixed #34262 -- Added support for AnyValue for SQLite, MySQL, Oracle, and Postgresql 16+.
Thanks Simon Charette for the guidance and review. Thanks Tim Schilling for the documentation review. Thanks David Wobrock for investigation and solution proposals.
Diffstat (limited to 'django/db/backends/sqlite3/_functions.py')
-rw-r--r--django/db/backends/sqlite3/_functions.py6
1 files changed, 6 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]