summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/fields/array.py
AgeCommit message (Collapse)Author
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.
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 -- 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-10-13Replaced multi-level relative imports with absolute imports in django/.lyova24
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-03-25Fixed #36276 -- Omitted size=None from ArrayField.deconstruct().Tim Graham
2025-01-03Removed stray comment in ArrayField.check().Tim Graham
2024-12-05Fixed #35944 -- Handled serialization of Unicode values in ArrayField and ↵Oleg Sverdlov
HStoreField.
2023-12-30Fixed #29049 -- Added slicing notation to F expressions.Nick Pope
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-02-07Fixed #34285 -- Fixed index/slice lookups on filtered aggregates with ↵Nils VAN ZUIJLEN
ArrayField. Thanks Simon Charette for the review.
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
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-10Fixed #34205 -- Fixed Meta.constraints validation crash with ArrayField and ↵James Gillard
__len lookup. Regression in 88fc9e2826044110b7b22577a227f122fe9c1fb5 that began manifesting in Django 4.1.
2022-11-03Fixed #34080 -- Fixed __exact lookup when nested arrays contain only NULL ↵Ion Alberdi
values. Thanks jerch and David Sanders for reviews.
2022-08-03Fixed #33872 -- Deprecated ↵Mariusz Felisiak
django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.
2022-08-02Fixed #33881 -- Added support for database collations to ↵Mariusz Felisiak
ArrayField(Char/TextFields).
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2020-11-26Refs #27095 -- Allowed (non-nested) arrays containing expressions for ↵Hannes Ljungberg
ArrayField lookups.
2019-11-05Fixed #30095 -- Fixed system check for RangeField/ArrayField.choices with ↵Hasan Ramezani
lists and tuples.
2019-10-17Refs #12990 -- Moved CheckFieldDefaultMixin to the ↵sage
django.db.models.fields.mixins.
2019-08-23Fixed #30715 -- Fixed crash of ArrayField lookups on ArrayAgg annotations ↵Mariusz Felisiak
over AutoField.
2019-08-23Reduced code duplication in ArrayField's lookups.Mariusz Felisiak
2019-08-05Moved indexes in ArrayField's Index and Slice transforms to SQL params.Mariusz Felisiak
Follow up to 7deeabc7c7526786df6894429ce89a9c4b614086. These lookups aren't vulnerable to SQL injection because both accept only integer indexes. It is a part of good practices.
2019-03-21Removed obsolete Lookup hook to prepare rhs expressions.Simon Charette
After 3a505c70e7b228bf1212c067a8f38271ca86ce09, all _prepare() methods return self.
2019-03-03Reverted "Fixed relative paths imports per isort 4.3.5."Mariusz Felisiak
This reverts commit 463fe11bc8b2d068e447c5df677e7a31c2af7e03 due to restore of relative paths sorting from isort < 4.3.5 in isort 4.3.10.
2019-02-25Fixed relative paths imports per isort 4.3.5.Mariusz Felisiak
2019-01-17Refs #28370 -- Removed support for the context arg of Field.from_db_value() ↵Tim Graham
and Expression.convert_value(). Per deprecation timeline.
2018-09-28Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev
2018-07-27Fixed #28291, #24726 -- Fixed ArrayField with JSONField and RangeFields.vinay karanam
2018-05-13Refs #29131 -- Fixed space handling in ArrayField's item_invalid message.Hasan Ramezani
2018-04-22Refs #29131 -- Made ArrayField error messages index from 1 instead of 0.Hasan Ramezani
2017-12-11Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking.Nick Pope
2017-11-01Fixed #28749 -- Added subquery support for ArrayField's __in lookup.Michał Pasternak
2017-10-20Fixed #28577 -- Added checks for ArrayField and JSONField to prevent mutable ↵Flávio Juvenal
defaults.
2017-09-13Merged isinstance() calls.Mariusz Felisiak
2017-07-20Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and ↵Tim Graham
Expression.convert_value(). Unused since a0d166306fbdc41f49e6fadf4ec84b17eb147daa.
2017-02-07Converted usage of ugettext* functions to their gettext* aliasesClaude Paroz
Thanks Tim Graham for the review.
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-14Refs #25226 -- Cloned ArrayField.base_field on deconstruction.Simon Charette
This prevents the base_field from sharing attributes with the one used during migrations.
2016-09-20Refs #27025 -- Fixed ArrayField querying on Python 3.6.Tim Graham
Python 3.6 parses strings like '0_1' as numeric literals. http://bugs.python.org/issue26331
2016-08-19Fixed #22288 -- Fixed F() expressions with the __range lookup.Matthew Wilkes
2016-03-15Fixed #25579 -- Fixed ArrayField.get_db_prep_value() to allow complex types.Matt C
2016-03-12Fixed #25143 -- Added ArrayField.from_db_value().Fernando Miranda
Thanks Karan Lyons for contributing to the patch.
2016-02-16Fixed #26215 -- Fixed RangeField/ArrayField serialization with None valuesClaude Paroz
Also added tests for HStoreField and JSONField. Thanks Aleksey Bukin for the report and Tim Graham for the initial patch and the review.
2016-02-12Removed unneeded hint=None/obj=None in system check messages.Tim Graham
2015-12-17Fixed #25841 -- Handled base array fields validation errors with params.Simon Charette
Thanks to Trac alias benzid-wael for the report.
2015-12-17Fixed #25544 -- Removed duplicate ids in prefetch_related() queries.Ian Foote
2015-12-07Fixed #25867 -- Fixed a system check crash with nested ArrayFields.Simon Charette
Thanks to Jean Gourds for the report, Tim and Claude for the review.
2015-11-25Fixed #25772 -- Corrected __len lookup on ArrayField for empty arrays.Attila Tovt