[1.7.x] Documented a current limitation of multiple table annotation; refs #10060.
Backport of 4b23a6c7a9
from master
This commit is contained in:
parent
82c0c7b34f
commit
48bd44670b
|
@ -179,6 +179,17 @@ of the ``annotate()`` clause is a ``QuerySet``; this ``QuerySet`` can be
|
||||||
modified using any other ``QuerySet`` operation, including ``filter()``,
|
modified using any other ``QuerySet`` operation, including ``filter()``,
|
||||||
``order_by()``, or even additional calls to ``annotate()``.
|
``order_by()``, or even additional calls to ``annotate()``.
|
||||||
|
|
||||||
|
.. admonition:: If in doubt, inspect the SQL query!
|
||||||
|
|
||||||
|
In order to understand what happens in your query, consider inspecting the
|
||||||
|
``query`` property of your ``QuerySet``.
|
||||||
|
|
||||||
|
For instance, combining multiple aggregations with ``annotate()`` will
|
||||||
|
yield the wrong results, as `multiple tables are the cross joined`_,
|
||||||
|
resulting in duplicate row aggregations.
|
||||||
|
|
||||||
|
.. _multiple tables are the cross joined: https://code.djangoproject.com/ticket/10060
|
||||||
|
|
||||||
Joins and aggregates
|
Joins and aggregates
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue