summaryrefslogtreecommitdiff
path: root/tests/aggregation
AgeCommit message (Collapse)Author
2020-05-14[3.1.x] Fixed #31568 -- Fixed alias reference when aggregating over multiple ↵Simon Charette
subqueries. 691def10a0197d83d2d108bd9043b0916d0f09b4 made all Subquery() instances equal to each other which broke aggregation subquery pushdown which relied on object equality to determine which alias it should select. Subquery.__eq__() will be fixed in an another commit but Query.rewrite_cols() should haved used object identity from the start. Refs #30727, #30188. Thanks Makina Corpus for the report. Backport of adfbf653dc1c1d0e0dacc4ed46602d22ba28b004 from master
2020-03-25Fixed #31377 -- Disabled grouping by aliases on ↵Hasan Ramezani
QuerySet.values()/values_list() when they collide with field names. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Holovashchenko Vadym for the report.
2020-03-03Refs #31331 -- Checked ONLY_FULL_GROUP_BY mode in ↵Mariusz Felisiak
AggregateTestCase.test_aggregation_subquery_annotation_multivalued().
2020-03-03Fixed #31150 -- Included subqueries that reference related fields in GROUP ↵Mariusz Felisiak
BY clauses. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Simon Charette <charette.s@gmail.com>
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-02-03Fixed #31217 -- Made QuerySet.values()/values_list() group by not selected ↵Mariusz Felisiak
annotations with aggregations used in order_by(). Regression in 59b4e99dd00b9c36d56055b889f96885995e4240. Thanks Jon Dufresne for the report and Simon Charette for the review.
2020-01-15Refs #31136 -- Made QuerySet.values()/values_list() group only by selected ↵Mariusz Felisiak
annotation. Regression in 0f843fdd5b9b2f2307148465cd60f4e1b2befbb4.
2020-01-04Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().Mariusz Felisiak
Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Sigurd Ljødal for the report.
2019-12-23Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().Simon Charette
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY references to it. Thanks Thierry Bastian for the report and Baptiste Mispelon for the bisect. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.
2019-12-19Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on ↵Simon Charette
aggregations. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-19Refs #31094 -- Added test for not using aliases in GROUP BY clauses.Simon Charette
2019-11-18Relaxed some query ordering assertions in tests.Tim Graham
It accounts for differences seen on cockroachdb.
2019-07-31Fixed #30665 -- Added support for distinct argument to Avg() and Sum().Étienne Beaulé
2019-07-31Moved test for distinct Count() to a separate test case.Étienne Beaulé
2019-06-10Fixed #30548 -- Improved exception when expression contains mixed types.CruxBox
2019-06-05Fixed #30542 -- Fixed crash of numerical aggregations with filter.Étienne Beaulé
Filters in annotations crashed when used with numerical-type aggregations (i.e. Avg, StdDev, and Variance). This was caused as the source expressions no not necessarily have an output_field (such as the filter field), which lead to an AttributeError: 'WhereNode' object has no attribute output_field. Thanks to Chuan-Zheng Lee for the report. Regression in c690afb873cac8035a3cb3be7c597a5ff0e4b261 and two following commits.
2019-05-08Refs #30462 -- Added test for conditional aggregation on annotated subquery.Mariusz Felisiak
2019-03-23Fixed #30246 -- Reused annotation aliases references in aggregation filters.Simon Charette
Thanks Jan Baryła for the detailed report and the reduced test case.
2019-03-21Fixed #30158 -- Avoided unnecessary subquery group by on aggregation.Simon Charette
Subquery annotations can be omitted from the GROUP BY clause on aggregation as long as they are not explicitly grouped against. Thanks Jonny Fuller for the report.
2019-01-21Fixed #30120 -- Fixed invalid SQL in distinct aggregate.Simon Charette
Regression in bc05547cd8c1dd511c6b6a6c873a1bc63417b111 (refs #28658).
2019-01-14Refs #28643 -- Changed Avg() to use NumericOutputFieldMixin.Nick Pope
Keeps precision instead of forcing DecimalField to FloatField.
2019-01-09Fixed #28658 -- Added DISTINCT handling to the Aggregate class.Simon Charette
2018-12-06Fixed #30011 -- Fixed queries that reuse filtered aggregates.Simon Charette
Thanks Taqi Abbas and Raphael Kimmig for the report.
2018-08-23Fixed #29048 -- Added **extra_context to database function as_vendor() methods.priyanshsaxena
2018-02-02Simplified aggregation.tests. Mariusz Felisiak
2017-08-12Fixed #27849 -- Added filtering support to aggregates.Tom
2017-07-21Refs #24887 -- Stopped mutating a test expression during as_sql().Simon Charette
Also defined an explicit output_field as it was mixing an expression with an IntegerField() with one with a DecimalField().
2017-07-11Fixed #28382 -- Prevented BaseExpression._output_field from being set if ↵Sergey Fedoseev
_resolve_output_field() fails.
2017-06-29Fixed #28277 -- Added validation of QuerySet.annotate() and aggregate() args.Mariusz Felisiak
Thanks Tim Graham and Nick Pope for reviews.
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed python_2_unicode_compatible decorator usageClaude Paroz
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2017-01-14Fixed tests that rely on hardcoded id with keepdbJosh Smeaton
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-04-05Fixed #26458 -- Based Avg's default output_field resolution on its source ↵Simon Charette
field type. Thanks Tim for the review and Josh for the input.
2016-03-28Sorted single letter imports per the latest version of isort.Tim Graham
2016-01-29Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as ↵Hasan
appropriate.
2015-12-03Fixed many spelling mistakes in code, comments, and docs.Josh Soref
2015-09-23Refs #14030 -- Removed backwards compatiblity for old-style aggregates.Tim Graham
Per deprecation timeline.
2015-09-14Fixed #25377 -- Changed Count queries to execute COUNT(*) instead of COUNT('*').Adam Chainz
2015-09-12Fixed #23395 -- Limited line lengths to 119 characters.Dražen Odobašić
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-07-27Fixed #25095 -- Fixed annotate() + values() group by bugMitchell Kotler
Thanks Josh Smeaton for help on the tests.
2015-07-13Fixed #24923 -- errored out nicely when using aggregates in order_by()Anssi Kääriäinen
2015-06-27Fixed #24887 -- Removed one-arg limit from models.aggregateGreg Chapple
2015-06-24Renamed RemovedInDjangoXYWarnings for new roadmap.Tim Graham
Forwardport of ae1d663b7913f6da233c55409c4973248372d302 from stable/1.8.x plus more.
2015-05-30Fixed #24699 -- Added aggregate support for DurationField on OracleJosh Smeaton
2015-04-25Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types.Tim Graham
2015-04-14Refs #24385 -- Added tests for distinct sum issue fixed in ↵Edward Henderson
c7fd9b242d2d63406f1de6cc3204e35aaa025233