summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2026-04-18 08:53:21 +0200
committerGitHub <noreply@github.com>2026-04-18 08:53:21 +0200
commited79c5959add54b6e8ea589ec601e0d2e801517e (patch)
tree0d00f241bea6de88203d1314c7de92cb262b3a3f /docs
parentd687d412a9abd9c80e31945f16ce32c020512394 (diff)
Fixed #37028 -- Added BitAnd(), BitOr(), and BitXor() aggregates.
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt4
-rw-r--r--docs/ref/contrib/postgres/aggregates.txt15
-rw-r--r--docs/ref/models/querysets.txt36
-rw-r--r--docs/releases/6.1.txt14
4 files changed, 69 insertions, 0 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index b0d62e9879..799c355334 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -69,6 +69,10 @@ details on these changes.
* The ``SQLCompiler.quote_name_unless_alias()`` method will be removed.
+* The ``django.contrib.postgres.aggregates.BitAnd``,
+ ``django.contrib.postgres.aggregates.BitOr``, and
+ ``django.contrib.postgres.aggregates.BitXor`` classes will be removed.
+
.. _deprecation-removed-in-6.1:
6.1
diff --git a/docs/ref/contrib/postgres/aggregates.txt b/docs/ref/contrib/postgres/aggregates.txt
index 040e57c5af..6381f0f7eb 100644
--- a/docs/ref/contrib/postgres/aggregates.txt
+++ b/docs/ref/contrib/postgres/aggregates.txt
@@ -62,6 +62,11 @@ General-purpose aggregation functions
Returns an ``int`` of the bitwise ``AND`` of all non-null input values, or
``default`` if all values are null.
+ .. deprecated:: 6.1
+
+ This class is deprecated in favor of the generally available
+ :class:`~django.db.models.BitAnd` class.
+
``BitOr``
---------
@@ -70,6 +75,11 @@ General-purpose aggregation functions
Returns an ``int`` of the bitwise ``OR`` of all non-null input values, or
``default`` if all values are null.
+ .. deprecated:: 6.1
+
+ This class is deprecated in favor of the generally available
+ :class:`~django.db.models.BitOr` class.
+
``BitXor``
----------
@@ -78,6 +88,11 @@ General-purpose aggregation functions
Returns an ``int`` of the bitwise ``XOR`` of all non-null input values, or
``default`` if all values are null.
+ .. deprecated:: 6.1
+
+ This class is deprecated in favor of the generally available
+ :class:`~django.db.models.BitXor` class.
+
``BoolAnd``
-----------
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 6a76fc2703..ee401a569d 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -4085,6 +4085,42 @@ by the aggregate.
unique values. This is the SQL equivalent of ``AVG(DISTINCT <field>)``.
The default value is ``False``.
+``BitAnd``
+~~~~~~~~~~
+
+.. class:: BitAnd(expression, filter=None, default=None, **extra)
+
+ .. versionadded:: 6.1
+
+ Returns an ``int`` of the bitwise ``AND`` of all non-null input values, or
+ ``default`` if all values are null.
+
+ The ``default`` parameter is not supported on MariaDB, MySQL, and Oracle.
+
+``BitOr``
+~~~~~~~~~
+
+.. class:: BitOr(expression, filter=None, default=None, **extra)
+
+ .. versionadded:: 6.1
+
+ Returns an ``int`` of the bitwise ``OR`` of all non-null input values, or
+ ``default`` if all values are null.
+
+ The ``default`` parameter is not supported on MariaDB, MySQL, and Oracle.
+
+``BitXor``
+~~~~~~~~~~
+
+.. class:: BitXor(expression, filter=None, default=None, **extra)
+
+ .. versionadded:: 6.1
+
+ Returns an ``int`` of the bitwise ``XOR`` of all non-null input values, or
+ ``default`` if all values are null.
+
+ The ``default`` parameter is not supported on MariaDB, MySQL, and Oracle.
+
``Count``
~~~~~~~~~
diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt
index 77188e0c8e..477117c004 100644
--- a/docs/releases/6.1.txt
+++ b/docs/releases/6.1.txt
@@ -315,6 +315,11 @@ Models
:class:`~django.db.models.query.QuerySet` is ordered and the ordering is
deterministic.
+* The new :class:`~django.db.models.BitAnd`, :class:`~django.db.models.BitOr`,
+ and :class:`~django.db.models.BitXor` aggregates return the bitwise ``AND``,
+ ``OR``, ``XOR``, respectively. These aggregates were previously included only
+ in ``contrib.postgres``.
+
Pagination
~~~~~~~~~~
@@ -420,6 +425,9 @@ backends.
``get_geom_placeholder_sql`` and is expected to return a two-elements tuple
composed of an SQL format string and a tuple of associated parameters.
+* Set the new ``DatabaseFeatures.supports_bit_aggregations`` attribute to
+ ``False`` if the database doesn't support bitwise aggregations.
+
:mod:`django.contrib.admin`
---------------------------
@@ -539,6 +547,12 @@ Miscellaneous
:ref:`expressions <writing-your-own-query-expressions>`, is deprecated in
favor of the newly introduced ``quote_name()`` method.
+* The ``BitAnd``, ``BitOr``, and ``BitXor`` classes in
+ ``django.contrib.postgres.aggregates`` are deprecated in favor of the
+ generally available :class:`~django.db.models.BitAnd`,
+ :class:`~django.db.models.BitOr`, and :class:`~django.db.models.BitXor`
+ classes.
+
Features removed in 6.1
=======================