summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
AgeCommit message (Collapse)Author
14 daysFixed #37028 -- Added BitAnd(), BitOr(), and BitXor() aggregates.Mariusz Felisiak
2026-03-12Fixed #36727 -- Deprecated Field.get_placeholder in favor of ↵Simon Charette
get_placeholder_sql. The lack of ability of the get_placeholder call chain to return SQL and parameters separated so they can be mogrified by the backend at execution time forced implementations to dangerously interpolate potentially user controlled values. The get_placeholder_sql name was chosen due to its proximity to the previous method, but other options such as Field.as_sql were considered but ultimately rejected due to its different input signature compared to Expression.as_sql that might have lead to confusion. There is a lot of overlap between what Field.get_db_prep_value and get_placeholder_sql do but folding the latter in the former would require changing its return signature to return expression which is a way more invasive change than what is proposed here. Given we always call get_db_prep_value it might still be an avenue worth exploring in the future to offer a publicly documented interface to allow field to take an active part in the compilation chain. Thanks Jacob for the review.
2026-01-20Refs #36639 -- Updated test migrations to match models.Skyiesac
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
2026-01-10Fixed #36827 -- Added support for exclusion constraints using Hash indexes ↵Haki Benita
on PostgreSQL.
2026-01-08Fixed #36852 -- Ignored index_type case in ExclusionConstraint equality check.Haki Benita
2025-12-03Fixed #36280 -- Replaced exception checks with assertRaisesMessage().Skyiesac
2025-12-02Refs #35444 -- Fixed typo in PostgreSQL StringAgg deprecation warning.Νικόλαος-Διγενής Καραγιάννης
2025-11-21Refs #36031 -- Added tests of DecimalRangeField __contains lookup with ↵Mariusz Felisiak
unbounded decimal ranges. Co-authored-by: Aman Sharma <210100011@iitb.ac.in>
2025-11-20Fixed #36748 -- Filtered non-standard placeholders from UNNEST queries.Chris Wesseling
2025-11-14Refs #24928 -- Added introspection support for PostgreSQL HStoreField.Mariusz Felisiak
2025-11-13Refs #31055 -- Adjusted passing of Field.check kwargs to ArrayField.base_field.Simon Charette
This was missed when Field.check(databases) was introduced.
2025-10-29Refs #35381 -- Deprecated using None in JSONExact rhs to mean JSON null.Clifford Gama
Key and index lookups are exempt from the deprecation. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2025-10-29Refs #35381 -- Delegated ArrayField element prepping to ↵Clifford Gama
base_field.get_db_prep_save. Previously, ArrayField always used base_field.get_db_prep_value when saving, which could differ from how base_field prepares data for save. This change overrides ArrayField.get_db_prep_save to delegate to the base_field's get_db_prep_save, ensuring elements like None in JSONField arrays are saved correctly as SQL NULL instead of JSON null.
2025-09-17Refs #35444 -- Removed contrib.postgres aggregates ordering kwarg per ↵Jacob Walls
deprecation timeline.
2025-09-16Fixed #28041 -- Added Lexeme expression to contrib.postgres.search.GappleBee
This expression automatically escapes its input and allows fine-grained control over prefix matching and term weighting via logical combinations. Thanks Mariusz Felisiak, Adam Zapletal, Paolo Melchiorre, Jacob Walls, Adam Johnson, and Simon Charette for reviews. Co-authored-by: joetsoi <joetsoi@users.noreply.github.com> Co-authored-by: Karl Hobley <karl@kaed.uk> Co-authored-by: Alexandr Tatarinov <tatarinov1997@gmail.com>
2025-09-05Fixed #36564 -- Changed DEFAULT_AUTO_FIELD from AutoField to BigAutoField.Tim Graham
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-07-22Fixed #36377 -- Added hints support to CreateExtension and subclasses.Anthony Sottile
2025-06-18Fixed #32770 -- Added system check to ensure django.contrib.postgres is ↵Clifford Gama
installed when using its features. Added postgres.E005 to validate 'django.contrib.postgres' is in INSTALLED_APPS when using: * PostgreSQL-specific fields (ArrayField, HStoreField, range fields, SearchVectorField), * PostgreSQL indexes (PostgresIndex and all subclasses), and * ExclusionConstraint The check provides immediate feedback during system checks rather than failing later with obscure runtime and database errors. Thanks to Simon Charette and Sarah Boyce for reviews.
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-25Fixed #36276 -- Omitted size=None from ArrayField.deconstruct().Tim Graham
2025-03-10Fixed #36222 -- Fixed ExclusionConstraint validation crash on excluded ↵saJaeHyukc
fields in condition. Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-07Corrected test case in ExclusionConstraintTests.test_invalid_expressions().Sarah Boyce
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-03-01Applied Black's 2025 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/25.1.0
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2025-02-05Fixed #36165 -- Made PostgreSQL's SchemaEditor._delete_index_sql() respect ↵Natalia
the "sql" argument. This is a follow up of bd366ca2aeffa869b7dbc0b0aa01caea75e6dc31. Thank you Daniel Finch for the report.
2025-01-30Fixed #35235 -- Removed caching of BaseExpression._output_field_or_none.sharonwoo
2025-01-20Fixed #36107 -- Adjusted UNNEST bulk_create strategy to opt-out sized arrays.Simon Charette
The array fields opt-out heuristic failed to account for sized arrays. Note that we keep relying on db_type as opposed to performing an ArrayField instance check against the column's field as there could be other implementations of model fields that use Postgres arrays to store the optimization must be disabled for all of them. Refs #35936. Thanks Claude Paroz for the report and test.
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-12-13Fixed typo in ArrayField test name.Tim Graham
2024-12-05Fixed #35944 -- Handled serialization of Unicode values in ArrayField and ↵Oleg Sverdlov
HStoreField.
2024-10-10Fixed #35717 -- Reduced Create/RemoveCollation operations when optimizing ↵Adam Johnson
migrations.
2024-10-07Fixed #35449 -- Fixed validation of array items in SplitArrayField when ↵GappleBee
remove_trailing_nulls=True.
2024-09-11Fixed #35732 -- Wrapped ConcatPair expression in parentheses to ensure ↵Gastón Avila
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 6364b6ee1071381eb3a23ba6b821fc0d6f0fce75. Co-authored-by: Emiliano Cuenca <106986074+emicuencac@users.noreply.github.com>
2024-09-03Fixed #35704 -- Fixed reduction for AddIndex subclasses.Adam Johnson
2024-08-12Fixed #35575 -- Added support for constraint validation on GeneratedFields.Mark Gensler
2024-08-05Fixed #35638 -- Updated validate_constraints to consider db_default.David Sanders
2024-07-03Refs #28900 -- Made SELECT respect the order specified by values(*selected).Simon Charette
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 d6b6e5d0fd4e6b6d0183b4cf6e4bd4f9afc7bf67. Thanks Mariusz Felisiak and Sarah Boyce for review.
2024-05-27Fixed #35479 -- Dropped support for PostgreSQL 13 and PostGIS 3.0.Mariusz Felisiak
2024-05-14Fixed #35275 -- Fixed Meta.constraints validation crash on UniqueConstraint ↵Mariusz Felisiak
with OpClass(). This also introduces Expression.constraint_validation_compatible that allows specifying that expression should be ignored during a constraint validation.
2024-05-10Fixed #35436 -- Fixed displaying Unicode chars in forms.HStoreField.SaJH
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.
2024-03-01Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.Simon Charette
Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses.
2024-02-29Fixed #35234 -- Added system checks for invalid model field names in ↵Simon Charette
ExclusionConstraint.expressions.
2024-02-09Fixed #35175 -- Made migraton writer preserve keyword-only arguments.David Sanders
Thanks Gerald Goh for the report.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2024-01-17Fixed #31700 -- Made makemigrations command display meaningful symbols for ↵Amir Karimi
each operation.