diff options
| author | Tim Graham <timograham@gmail.com> | 2015-12-08 16:45:15 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-15 08:04:43 -0500 |
| commit | ea63cf8d424780aed35e9973bf5e4dbb652c7d8a (patch) | |
| tree | 5e2d5d169fa76aff95f63a8c9f3e898bb876577a /docs | |
| parent | 192d1eb5c3691cd7bb6e5f9caaaf5bb00c60664e (diff) | |
[1.9.x] Refs #10060 -- Corrected description of multiple annotations bug.
Backport of 3d2236773ba88e330841b8c72183b0e978e10909 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/db/aggregation.txt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt index f34648124e..bfb48ffec9 100644 --- a/docs/topics/db/aggregation.txt +++ b/docs/topics/db/aggregation.txt @@ -190,9 +190,8 @@ Combining multiple aggregations ------------------------------- Combining multiple aggregations with ``annotate()`` will `yield the wrong -results <https://code.djangoproject.com/ticket/10060>`_, as multiple tables are -cross joined. Due to the use of ``LEFT OUTER JOIN``, duplicate records will be -generated if some of the joined tables contain more records than the others: +results <https://code.djangoproject.com/ticket/10060>`_ because joins are used +instead of subqueries: >>> Book.objects.first().authors.count() 2 @@ -374,8 +373,8 @@ Both queries return a list of publishers that have at least one book with a rating exceeding 3.0, hence publisher C is excluded. In the first query, the annotation precedes the filter, so the filter has no -effect on the annotation. ``distinct=True`` is required to avoid a -:ref:`cross-join bug <combining-multiple-aggregations>`. +effect on the annotation. ``distinct=True`` is required to avoid a :ref:`query +bug <combining-multiple-aggregations>`. The second query counts the number of books that have a rating exceeding 3.0 for each publisher. The filter precedes the annotation, so the filter |
