summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Bach <benjaoming@gmail.com>2014-12-01 00:02:43 +0100
committerTim Graham <timograham@gmail.com>2014-12-03 19:18:55 -0500
commit4b23a6c7a9232cc07ec95fe98be17efbd4449822 (patch)
tree70f138d93dfbac1a3efd67f5a65cfeb04acbfbcf
parent16f26defa7510707742a15aa89cae56f11d14c3f (diff)
Documented a current limitation of multiple table annotation; refs #10060.
-rw-r--r--docs/topics/db/aggregation.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt
index 14c0cf2433..e33a2f12a0 100644
--- a/docs/topics/db/aggregation.txt
+++ b/docs/topics/db/aggregation.txt
@@ -184,6 +184,17 @@ of the ``annotate()`` clause is a ``QuerySet``; this ``QuerySet`` can be
modified using any other ``QuerySet`` operation, including ``filter()``,
``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
====================