diff options
| author | Benjamin Bach <benjaoming@gmail.com> | 2014-12-01 00:02:43 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-03 19:19:28 -0500 |
| commit | 48bd44670b4c58735d5cdf6762d6b61219ecbb12 (patch) | |
| tree | 74e2aaf6288d64892116f9140380acbeb5b19a6d /docs | |
| parent | 82c0c7b34fa599ac24036121cc34cea1c0b954fb (diff) | |
[1.7.x] Documented a current limitation of multiple table annotation; refs #10060.
Backport of 4b23a6c7a9232cc07ec95fe98be17efbd4449822 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/aggregation.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt index 9e02b50c67..6f09ea9c52 100644 --- a/docs/topics/db/aggregation.txt +++ b/docs/topics/db/aggregation.txt @@ -179,6 +179,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 ==================== |
