Commit Graph

46 Commits

Author SHA1 Message Date
Mariusz Felisiak b049bec7cf Fixed #35479 -- Dropped support for PostgreSQL 13 and PostGIS 3.0. 2024-05-27 09:49:25 +02:00
Chris Muthig c8df2f9941 Fixed #35339 -- Fixed PostgreSQL aggregate's filter and order_by params order.
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.
2024-04-25 17:40:03 -03:00
Mariusz Felisiak 5e4c1793b7 Refs #33308 -- Removed support for passing encoded JSON string literals to JSONField & co.
Per deprecation timeline.
2023-09-18 22:12:40 +02:00
David Smith b05dfc2894
Refs #34381, Refs #10929 -- Fixed postgres_tests.test_aggregates.TestGeneralAggretate.test_empty_result_set() on PostgreSQL 14+.
Follow up to 0be8095b25.
2023-03-05 19:06:21 +01:00
Nils VAN ZUIJLEN ae1fe72e9b Fixed #34285 -- Fixed index/slice lookups on filtered aggregates with ArrayField.
Thanks Simon Charette for the review.
2023-02-07 13:16:41 +01:00
Mariusz Felisiak 0be8095b25 Refs #10929 -- Stopped forcing empty result value by PostgreSQL aggregates.
Per deprecation timeline.
2023-01-17 11:49:15 +01:00
Simon Charette eccda63a49 Improved isolation of TestGeneralAggregate.test_default_argument(). 2022-12-02 13:58:46 +01:00
Simon Charette 0ff46591ac Refs #33308 -- Deprecated support for passing encoded JSON string literals to JSONField & co.
JSON should be provided as literal Python objects an not in their
encoded string literal forms.
2022-12-01 19:14:00 +01:00
Simon Charette 0db8bf3d60 Refs #10929 -- Fixed aggregates crash when passing strings as defaults.
Previously strings were interpreted as F() expressions and default
crashed with AttributeError:
    'F' object has no attribute 'empty_result_set_value'
2022-11-29 13:08:05 +01:00
Alexander Kerkum f88fc72da4 Fixed #34016 -- Fixed QuerySet.values()/values_list() crash on ArrayAgg() and JSONBAgg().
Regression in e06dc4571e.
2022-09-17 19:38:20 +02:00
Mariusz Felisiak fd93db97c7
Fixed #33898 -- Fixed Window() expression crash with ArrayAgg().
Thanks Kia for the report.

Regression in e06dc4571e.
2022-08-06 17:59:31 +02:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Nick Pope bd47b9bc81 Fixed #32961 -- Added BitXor() aggregate to django.contrib.postgres. 2021-10-01 10:32:39 +02:00
ali ca58378390 Fixed #33114 -- Defined default output_field of StringAgg.
Thanks Simon Charette for the review.
2021-09-27 06:58:54 +02:00
abhiabhi94 5a634a7b6f Fixed #32906 -- Added docs and tests for using key and index lookups on JSONBAgg results.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-26 11:23:51 +02:00
Nick Pope fee8734596 Refs #10929 -- Deprecated forced empty result value for PostgreSQL aggregates.
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-19 13:41:16 +02:00
Nick Pope 501a8db465 Fixed #10929 -- Added default argument to aggregates.
Thanks to Simon Charette and Adam Johnson for the reviews.
2021-07-19 13:04:27 +02:00
Hannes Ljungberg d8c90d4c22 Fixed #32786 -- Moved subquery ordering clearing optimization to the _in lookup.
Co-Authored-By: Simon Charette <charette.s@gmail.com>
2021-06-30 10:08:55 +02:00
Mariusz Felisiak 5371ad1d14
Refs #26430 -- Added tests for PostgreSQL-specific aggregates on EmptyQuerySets and used subTest(). 2021-06-29 20:23:59 +02:00
Nick Pope 66af94d56e Removed unnecessary json.loads() call in test_json_agg_empty(). 2021-06-28 09:22:23 +02:00
Nick Pope e8e8e207e7 Ensured that empty result test for JSONBAgg executes a query.
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-28 09:21:57 +02:00
Nick Pope 1aca9fc7d2 Corrected test method and variable names for JSONBAgg.
This is probably a hangover from when the aggregate function was
originally called JSONAgg during development.
2021-06-28 09:17:34 +02:00
Artur Beltsov 18c8ced81e Fixed #32169 -- Added distinct support to JSONBAgg. 2020-11-04 21:22:54 +01:00
Mariusz Felisiak 1f31027bb3 Refs #32096 -- Fixed crash of ArrayAgg/StringAgg/JSONBAgg with ordering over JSONField key transforms.
Regression in 6789ded0a6.

Thanks Igor Jerosimić for the report.
2020-10-14 20:56:04 +02:00
Mariusz Felisiak 1d650ad019 Refs #32096 -- Added test for ArrayAgg over JSONField key transforms. 2020-10-14 20:56:04 +02:00
David Chorpash 6ec5eb5d74 Refs #31720 -- Defined default output_field of BoolAnd() and BoolOr() aggregate functions. 2020-07-21 06:42:51 +02:00
John Parton a8473b4d34 Fixed #31691 -- Added ordering support to JSONBAgg. 2020-06-13 00:06:29 +02:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Simon Charette eb31d84532 Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter. 2020-02-03 08:49:13 +01:00
David Wobrock 2f565f84ac Fixed #31097 -- Fixed crash of ArrayAgg and StringAgg with filter when used in Subquery. 2019-12-31 10:35:43 +01:00
David Wobrock 7d44aeb388 Refs #31097 -- Added tests for filter in ArrayAgg and StringAgg. 2019-12-31 10:35:39 +01:00
Caio Ariede a3f91891d2 Fixed #30315 -- Fixed crash of ArrayAgg and StringAgg with ordering when used in Subquery. 2019-05-28 10:05:50 +02:00
Simone Pellizzari d0315584b5
Fixed #30332 -- Fixed crash of ordering by expressions with params in ArrayAgg and StringAgg. 2019-04-06 14:23:29 +02:00
Simone Pellizzari 47a1f2a06f
Refs #26067 -- Added more tests for ordering in StringAgg. 2019-04-06 13:41:46 +02:00
Tim Graham 39ebdf5a3c Fixed #30155 -- Dropped support for PostgreSQL 9.4 and PostGIS 2.1. 2019-02-04 18:07:02 -05:00
Floris den Hengst 96199e562d Fixed #26067 -- Added ordering support to ArrayAgg and StringAgg. 2018-06-28 20:29:33 -04:00
Sergey Fedoseev 1490611038 Fixed #28908 -- Allowed ArrayField lookups on ArrayAgg annotations. 2017-12-30 14:46:52 -05:00
Tim Graham 6e4c6281db Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Mads Jensen 550cb3a365 Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). 2017-06-28 14:07:55 -04:00
orf b5393028bf Fixed #27767 -- Added distinct argument to ArrayAgg. 2017-02-04 13:57:39 -05:00
Mads Jensen aa2cb4c622 Refs #26327 -- Renamed JsonAgg to JSONBAgg.
Thanks to Christian von Roques for the report.
2016-11-28 06:57:01 -05:00
Mads Jensen 0a26f3c338 Fixed #26327 -- Added JsonAgg to contrib.postgres.
Thanks Tim Graham for review.
2016-10-07 07:52:03 -04:00
Rustam Kashapov df8412d2e5 Fixed #26617 -- Added distinct argument to contrib.postgres's StringAgg. 2016-06-02 13:48:35 -04:00
Marc Tamlyn 00e8e514e1 Name PostgreSQL correctly. 2015-05-30 23:10:30 +01:00
Claude Paroz 36e90d1f45 Stopped special-casing postgres-specific tests
Refs #23879.
2015-04-18 15:17:49 +02:00
Andriy Sokolovskiy e4cf8c8420 Fixed #24301 -- Added PostgreSQL-specific aggregate functions 2015-03-30 10:44:37 -04:00