mirror of
https://github.com/django/django.git
synced 2025-08-30 07:17:49 +00:00
Refs #10929 -- Deprecated forced empty result value for PostgreSQL aggregates.
This deprecates forcing a return value for ArrayAgg, JSONBAgg, and StringAgg when there are no rows in the query. Now that we have a ``default`` argument for aggregates, we want to revert to returning the default of ``None`` which most aggregate functions return and leave it up to the user to decide what they want to be returned by default.
This commit is contained in:
parent
501a8db465
commit
fee8734596
5 changed files with 130 additions and 18 deletions
|
@ -52,6 +52,13 @@ General-purpose aggregation functions
|
|||
from django.db.models import F
|
||||
F('some_field').desc()
|
||||
|
||||
.. deprecated:: 4.0
|
||||
|
||||
If there are no rows and ``default`` is not provided, ``ArrayAgg``
|
||||
returns an empty list instead of ``None``. This behavior is deprecated
|
||||
and will be removed in Django 5.0. If you need it, explicitly set
|
||||
``default`` to ``Value([])``.
|
||||
|
||||
``BitAnd``
|
||||
----------
|
||||
|
||||
|
@ -138,6 +145,13 @@ General-purpose aggregation functions
|
|||
|
||||
Examples are the same as for :attr:`ArrayAgg.ordering`.
|
||||
|
||||
.. deprecated:: 4.0
|
||||
|
||||
If there are no rows and ``default`` is not provided, ``JSONBAgg``
|
||||
returns an empty list instead of ``None``. This behavior is deprecated
|
||||
and will be removed in Django 5.0. If you need it, explicitly set
|
||||
``default`` to ``Value('[]')``.
|
||||
|
||||
``StringAgg``
|
||||
-------------
|
||||
|
||||
|
@ -164,6 +178,13 @@ General-purpose aggregation functions
|
|||
|
||||
Examples are the same as for :attr:`ArrayAgg.ordering`.
|
||||
|
||||
.. deprecated:: 4.0
|
||||
|
||||
If there are no rows and ``default`` is not provided, ``StringAgg``
|
||||
returns an empty string instead of ``None``. This behavior is
|
||||
deprecated and will be removed in Django 5.0. If you need it,
|
||||
explicitly set ``default`` to ``Value('')``.
|
||||
|
||||
Aggregate functions for statistics
|
||||
==================================
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue