summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_aggregates.py
AgeCommit message (Collapse)Author
2026-04-18Fixed #37028 -- Added BitAnd(), BitOr(), and BitXor() aggregates.Mariusz Felisiak
2025-12-02Refs #35444 -- Fixed typo in PostgreSQL StringAgg deprecation warning.Νικόλαος-Διγενής Καραγιάννης
2025-09-17Refs #35444 -- Removed contrib.postgres aggregates ordering kwarg per ↵Jacob Walls
deprecation timeline.
2025-05-23Fixed #36405 -- Fixed Aggregate.order_by using OuterRef.Adam Johnson
co-authored-by: Simon Charette <charette.s@gmail.com>
2025-04-16Americanized some spellings.Adam Johnson
2025-03-03Fixed #35444 -- Added generic support for Aggregate.order_by.Chris Muthig
This moves the behaviors of `order_by` used in Postgres aggregates into the `Aggregate` class. This allows for creating aggregate functions that support this behavior across all database engines. This is shown by moving the `StringAgg` class into the shared `aggregates` module and adding support for all databases. The Postgres `StringAgg` class is now a thin wrapper on the new shared `StringAgg` class. Thank you Simon Charette for the review.
2025-01-30Fixed #35235 -- Removed caching of BaseExpression._output_field_or_none.sharonwoo
2025-01-06Refs #35444 -- Deprecated contrib.postgres aggregates ordering for order_by.Chris Muthig
Aligns the argument with SQL standards already used in Window.order_by and sets up for adding support to Aggregate.
2024-05-27Fixed #35479 -- Dropped support for PostgreSQL 13 and PostGIS 3.0.Mariusz Felisiak
2024-04-25Fixed #35339 -- Fixed PostgreSQL aggregate's filter and order_by params order.Chris Muthig
Updated OrderableAggMixin.as_sql() to separate the order_by parameters from the filter parameters. Previously, the parameters and SQL were calculated by the Aggregate parent class, resulting in a mixture of order_by and filter parameters. Thanks Simon Charette for the review.
2023-09-18Refs #33308 -- Removed support for passing encoded JSON string literals to ↵Mariusz Felisiak
JSONField & co. Per deprecation timeline.
2023-03-05Refs #34381, Refs #10929 -- Fixed ↵David Smith
postgres_tests.test_aggregates.TestGeneralAggretate.test_empty_result_set() on PostgreSQL 14+. Follow up to 0be8095b254fad65b2480d677ebe6098c41bbad6.
2023-02-07Fixed #34285 -- Fixed index/slice lookups on filtered aggregates with ↵Nils VAN ZUIJLEN
ArrayField. Thanks Simon Charette for the review.
2023-01-17Refs #10929 -- Stopped forcing empty result value by PostgreSQL aggregates.Mariusz Felisiak
Per deprecation timeline.
2022-12-02Improved isolation of TestGeneralAggregate.test_default_argument().Simon Charette
2022-12-01Refs #33308 -- Deprecated support for passing encoded JSON string literals ↵Simon Charette
to JSONField & co. JSON should be provided as literal Python objects an not in their encoded string literal forms.
2022-11-29Refs #10929 -- Fixed aggregates crash when passing strings as defaults.Simon Charette
Previously strings were interpreted as F() expressions and default crashed with AttributeError: 'F' object has no attribute 'empty_result_set_value'
2022-09-17Fixed #34016 -- Fixed QuerySet.values()/values_list() crash on ArrayAgg() ↵Alexander Kerkum
and JSONBAgg(). Regression in e06dc4571ea9fd5723c8029959b95808be9f8812.
2022-08-06Fixed #33898 -- Fixed Window() expression crash with ArrayAgg().Mariusz Felisiak
Thanks Kia for the report. Regression in e06dc4571ea9fd5723c8029959b95808be9f8812.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-10-01Fixed #32961 -- Added BitXor() aggregate to django.contrib.postgres.Nick Pope
2021-09-27Fixed #33114 -- Defined default output_field of StringAgg.ali
Thanks Simon Charette for the review.
2021-07-26Fixed #32906 -- Added docs and tests for using key and index lookups on ↵abhiabhi94
JSONBAgg results. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-19Refs #10929 -- Deprecated forced empty result value for PostgreSQL aggregates.Nick Pope
This deprecates forcing a return value for ArrayAgg, JSONBAgg, and StringAgg when there are no rows in the query. Now that we have a ``default`` argument for aggregates, we want to revert to returning the default of ``None`` which most aggregate functions return and leave it up to the user to decide what they want to be returned by default.
2021-07-19Fixed #10929 -- Added default argument to aggregates.Nick Pope
Thanks to Simon Charette and Adam Johnson for the reviews.
2021-06-30Fixed #32786 -- Moved subquery ordering clearing optimization to the _in lookup.Hannes Ljungberg
Co-Authored-By: Simon Charette <charette.s@gmail.com>
2021-06-29Refs #26430 -- Added tests for PostgreSQL-specific aggregates on ↵Mariusz Felisiak
EmptyQuerySets and used subTest().
2021-06-28Removed unnecessary json.loads() call in test_json_agg_empty().Nick Pope
2021-06-28Ensured that empty result test for JSONBAgg executes a query.Nick Pope
Use of QuerySet.none() will cause the EmptyQuerySet aggregation optimisation to be used. Change the test to be implemented like the other tests for empty results in this file.
2021-06-28Corrected test method and variable names for JSONBAgg.Nick Pope
This is probably a hangover from when the aggregate function was originally called JSONAgg during development.
2020-11-04Fixed #32169 -- Added distinct support to JSONBAgg.Artur Beltsov
2020-10-14Refs #32096 -- Fixed crash of ArrayAgg/StringAgg/JSONBAgg with ordering over ↵Mariusz Felisiak
JSONField key transforms. Regression in 6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd. Thanks Igor Jerosimić for the report.
2020-10-14Refs #32096 -- Added test for ArrayAgg over JSONField key transforms.Mariusz Felisiak
2020-07-21Refs #31720 -- Defined default output_field of BoolAnd() and BoolOr() ↵David Chorpash
aggregate functions.
2020-06-13Fixed #31691 -- Added ordering support to JSONBAgg.John Parton
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-02-03Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter.Simon Charette
2019-12-31Fixed #31097 -- Fixed crash of ArrayAgg and StringAgg with filter when used ↵David Wobrock
in Subquery.
2019-12-31Refs #31097 -- Added tests for filter in ArrayAgg and StringAgg.David Wobrock
2019-05-28Fixed #30315 -- Fixed crash of ArrayAgg and StringAgg with ordering when ↵Caio Ariede
used in Subquery.
2019-04-06Fixed #30332 -- Fixed crash of ordering by expressions with params in ↵Simone Pellizzari
ArrayAgg and StringAgg.
2019-04-06Refs #26067 -- Added more tests for ordering in StringAgg.Simone Pellizzari
2019-02-04Fixed #30155 -- Dropped support for PostgreSQL 9.4 and PostGIS 2.1.Tim Graham
2018-06-28Fixed #26067 -- Added ordering support to ArrayAgg and StringAgg.Floris den Hengst
2017-12-30Fixed #28908 -- Allowed ArrayField lookups on ArrayAgg annotations.Sergey Fedoseev
2017-09-07Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."Tim Graham
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
2017-06-28Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().Mads Jensen
2017-02-04Fixed #27767 -- Added distinct argument to ArrayAgg.orf
2016-11-28Refs #26327 -- Renamed JsonAgg to JSONBAgg.Mads Jensen
Thanks to Christian von Roques for the report.
2016-10-07Fixed #26327 -- Added JsonAgg to contrib.postgres.Mads Jensen
Thanks Tim Graham for review.