Commit Graph

388 Commits

Author SHA1 Message Date
Gastón Avila c3ca6075cc Fixed #35732 -- Wrapped ConcatPair expression in parentheses to ensure operator precedence.
When ConcatPair was updated to use || this lost the implicit wrapping from CONCAT(...).
This broke the WHERE clauses when used in combination with PostgreSQL trigram similarity.

Regression in 6364b6ee10.

Co-authored-by: Emiliano Cuenca <106986074+emicuencac@users.noreply.github.com>
2024-09-11 14:36:56 +02:00
Adam Johnson f5ddd54986 Fixed #35704 -- Fixed reduction for AddIndex subclasses. 2024-09-03 12:51:06 +02:00
Mark Gensler 228128618b Fixed #35575 -- Added support for constraint validation on GeneratedFields. 2024-08-12 13:45:57 +02:00
David Sanders 509763c799 Fixed #35638 -- Updated validate_constraints to consider db_default. 2024-08-05 17:33:12 +02:00
Simon Charette 65ad4ade74 Refs #28900 -- Made SELECT respect the order specified by values(*selected).
Previously the order was always extra_fields + model_fields + annotations with
respective local ordering inferred from the insertion order of *selected.

This commits introduces a new `Query.selected` propery that keeps tracks of the
global select order as specified by on values assignment. This is crucial
feature to allow the combination of queries mixing annotations and table
references.

It also allows the removal of the re-ordering shenanigans perform by
ValuesListIterable in order to re-map the tuples returned from the database
backend to the order specified by values_list() as they'll be in the right
order at query compilation time.

Refs #28553 as the initially reported issue that was only partially fixed
for annotations by d6b6e5d0fd.

Thanks Mariusz Felisiak and Sarah Boyce for review.
2024-07-03 16:36:25 +02:00
Mariusz Felisiak b049bec7cf Fixed #35479 -- Dropped support for PostgreSQL 13 and PostGIS 3.0. 2024-05-27 09:49:25 +02:00
Mariusz Felisiak f030236a86 Fixed #35275 -- Fixed Meta.constraints validation crash on UniqueConstraint with OpClass().
This also introduces Expression.constraint_validation_compatible that
allows specifying that expression should be ignored during a constraint
validation.
2024-05-14 10:34:30 +02:00
SaJH f92ac845a9 Fixed #35436 -- Fixed displaying Unicode chars in forms.HStoreField. 2024-05-10 09:42:07 +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
Simon Charette daf7d482db Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the
documented method that performs system checks for BaseConstraint
subclasses.
2024-03-01 07:15:32 +01:00
Simon Charette f82c67aa21 Fixed #35234 -- Added system checks for invalid model field names in ExclusionConstraint.expressions. 2024-02-29 12:22:17 +01:00
David Sanders 06264258dc Fixed #35175 -- Made migraton writer preserve keyword-only arguments.
Thanks Gerald Goh for the report.
2024-02-09 09:37:13 +01:00
Mariusz Felisiak 305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Amir Karimi 27a3eee721 Fixed #31700 -- Made makemigrations command display meaningful symbols for each operation. 2024-01-17 14:00:02 +01:00
Nick Pope 45f778eded Fixed #35075 -- Added deduplicate_items parameter to BTreeIndex. 2024-01-02 12:55:12 +01:00
Nick Pope 94b6f101f7
Fixed #29049 -- Added slicing notation to F expressions.
Co-authored-by: Priyansh Saxena <askpriyansh@gmail.com>
Co-authored-by: Niclas Olofsson <n@niclasolofsson.se>
Co-authored-by: David Smith <smithdc@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Abhinav Yadav <abhinav.sny.2002@gmail.com>
2023-12-30 08:24:30 +01:00
Simon Charette b0ad41198b Fixed #34013 -- Added QuerySet.order_by() support for annotation transforms.
Thanks Eugene Morozov and Ben Nace for the reports.
2023-12-12 05:51:33 +01:00
David Sanders 4f2ae0644d Fixed #34849 -- Avoided raising RuntimeWarning about import-time queries when apps are reinitialized with test tools.
Regression in fbd16438f4.
2023-09-25 08:17:03 +02:00
Mariusz Felisiak 2c6ebb65c9
Fixed #34851 -- Dropped support for PostgreSQL 12 and PostGIS 2.5. 2023-09-20 13:45:51 +02: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
Mariusz Felisiak 04eb1b4567 Refs #33872 -- Removed django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.
Per deprecation timeline.
2023-09-18 22:12:40 +02:00
şuayip üzülmez 0c5146523b Fixed #34662 -- Corrected number in error messages for Array(Min/Max)LengthValidator. 2023-06-18 14:32:51 +02:00
Mariusz Felisiak 4bf4222010 Fixed #34459 -- Fixed SearchVector() crash for parameters with % symbol.
Thanks Patryk Zawadzki for the report.

Regression in 09ffc5c121.
2023-04-06 13:32:47 +02:00
Mariusz Felisiak 02a04ab79a Moved SearchVectorIndexTests.test_search_vector_index to postgres_tests.test_indexes. 2023-04-06 13:32:47 +02:00
David Wobrock d6b6e5d0fd Fixed #28553 -- Fixed annotation mismatch with QuerySet.values()/values_list() on compound queries.
Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
2023-03-24 06:09:27 +01:00
Jon Janzen e83a88566a Fixed #32172 -- Adapted signals to allow async handlers.
co-authored-by: kozzztik <kozzztik@mail.ru>
co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-03-07 08:39:25 +01: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
Xavier Fernandez 5b3d3e400a Fixed #34338 -- Allowed customizing code of ValidationError in BaseConstraint and subclasses. 2023-02-23 10:58:20 +01:00
Xavier Fernandez 51c9bb7cd1 Refs #33829 -- Added violation_error_message to constraints' __repr__(). 2023-02-23 05:35:58 +01:00
Simon Charette 278881e376 Fixed #34346 -- Ordered selected expressions by position.
Used the same approach as for #34176 by using selected expressions
position to prevent ambiguous aliases in collisions.

Thanks henribru for the report.

Regression in 04518e310d.
2023-02-20 05:54:25 +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
David Smith 097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.

https://github.com/psf/black/releases/tag/23.1.0
2023-02-01 11:04:38 +01:00
Mariusz Felisiak 23ec318988 Refs #33342 -- Removed ExclusionConstraint.opclasses per deprecation timeline. 2023-01-17 11:49:15 +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 dd68af62b2 Fixed #34176 -- Fixed grouping by ambiguous aliases.
Regression in b7b28c7c18.

Refs #31377.

Thanks Shai Berger for the report and reviews.

test_aggregation_subquery_annotation_values_collision() has been
updated as queries that are explicitly grouped by a subquery should
always be grouped by it and not its outer columns even if its alias
collides with referenced table columns. This was not possible to
accomplish at the time 10866a10 landed because we didn't have compiler
level handling of colliding aliases.
2023-01-09 10:52:51 +01:00
Adrian Torres 7eee1dca42 Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-28 12:31:04 +01:00
Daniele Varrazzo 09ffc5c121 Fixed #33308 -- Added support for psycopg version 3.
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.

Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-15 06:17:57 +01:00
Florian Apolloner 2ebfbd894e Refs #33308 -- Moved psycopg2 imports to the psycopg_any module. 2022-12-12 08:36:17 +01:00
James Gillard c5ed884eab Fixed #34205 -- Fixed Meta.constraints validation crash with ArrayField and __len lookup.
Regression in 88fc9e2826 that began
manifesting in Django 4.1.
2022-12-10 17:46:13 +01:00
Florian Apolloner d8c8761901 Used homogeneous weights list in SearchRank tests.
A homogenous array is required on PostgreSQL.
2022-12-06 12:52:56 +01:00
Daniele Varrazzo c14e5c64c9 Fixed typo in tests/postgres_tests/test_signals.py comment. 2022-12-06 12:52:56 +01:00
Pablo e673c87b56 Fixed #29084 -- Skipped some postgres_tests.test_search tests when pg_catalog isn't English. 2022-12-06 08:26:43 +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
Daniele Varrazzo d3e746ace5 Refs #33308 -- Added get_type_oids() hook and simplified registering type handlers on PostgreSQL. 2022-12-01 11:05:57 +01:00
Florian Apolloner 149b55fefa Refs #33308 -- Ensured type handlers are registered for all PostgreSQL specific tests.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-01 09:39:46 +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
Ben Cail fbde929b19 Fixed #26056 -- Added QuerySet.values()/values_list() support for ArrayField's __overlap lookup.
Thanks Mads Jensen and kosz85 and the initial patch.
2022-11-18 05:53:37 +01:00
Márton Salomváry d6cbf39a1b Fixed #34149 -- Allowed adding deferrable conditional exclusion constraints on PostgreSQL. 2022-11-10 11:07:24 +01:00
Ion Alberdi 3dc9f3ac69 Fixed #34080 -- Fixed __exact lookup when nested arrays contain only NULL values.
Thanks jerch and David Sanders for reviews.
2022-11-03 06:59:49 +01:00