summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/fields
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-31Refs #28909 -- Simplified code using unpacking generalizations.Aarni Koskela
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-09-18Refs #33872 -- Removed ↵Mariusz Felisiak
django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField. Per deprecation timeline.
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-12Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner
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-09Fixed #33905 -- Fixed CheckConstraint() validation on range fields.David Sanders
Bug in 667105877e6723c6985399803a364848891513cc.
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 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-11-04Fixed #27147 -- Allowed specifying bounds of tuple inputs for non-discrete ↵Guilherme Martins Crocetti
range fields.
2021-01-14Refs #12990 -- Removed ↵Mariusz Felisiak
django.contrib.postgres.fields.jsonb.KeyTransform/KeyTextTransform. Per deprecation timeline.
2021-01-14Refs #12990 -- Removed django.contrib.postgres.fields.JSONField per ↵Mariusz Felisiak
deprecation timeline.
2020-11-26Refs #27095 -- Allowed (non-nested) arrays containing expressions for ↵Hannes Ljungberg
ArrayField lookups.
2020-07-15Fixed #30446 -- Resolved Value.output_field for stdlib types.Simon Charette
This required implementing a limited form of dynamic dispatch to combine expressions with numerical output. Refs #26355 should eventually provide a better interface for that.
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-01Refs #12990 -- Moved PostgresSimpleLookup to the ↵Mariusz Felisiak
django.db.models.lookups.PostgresOperatorLookup.
2019-12-05Fixed #31039 -- Added support for contained_by lookup with AutoFields, ↵Hasan Ramezani
SmallIntegerField, and DecimalField.
2019-12-05Refs #31039 -- Removed unnecessary registration of contained_by lookup for ↵Hasan Ramezani
BigIntegerField. It's already registered for IntegerField.
2019-11-14Fixed #29916 -- Added lower_inc, lower_inf, upper_inc, and upper_inf lookups ↵Dulmandakh
for RangeFields. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
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-09-16Fixed #30769 -- Fixed a crash when filtering against a subquery ↵Simon Charette
JSON/HStoreField annotation. This was a regression introduced by 7deeabc7c7526786df6894429ce89a9c4b614086 to address CVE-2019-14234. Thanks Tim Kleinschmidt for the report and Mariusz for the tests.
2019-09-10Refs #29598 -- Removed FloatRangeField per deprecation timeline.Mariusz Felisiak
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-14Fixed #30672 -- Fixed crash of JSONField/HStoreField key transforms on ↵Mariusz Felisiak
expressions with params. Regression in 4f5b58f5cd3c57fee9972ab074f8dc6895d8f387. Thanks Florian Apolloner for the report and helping with tests.
2019-08-13Fixed #30704 -- Fixed crash of JSONField nested key and index transforms on ↵Mariusz Felisiak
expressions with params. Thanks Florian Apolloner for the report and helping with tests.
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-08-01Fixed CVE-2019-14234 -- Protected JSONField/HStoreField key and index ↵Mariusz Felisiak
lookups against SQL injection. Thanks to Sage M. Abdullah for the report and initial patch. Thanks Florian Apolloner for reviews.
2019-07-16Fixed #29824 -- Added support for database exclusion constraints on PostgreSQL.Mads Jensen
Thanks to Nick Pope and Mariusz Felisiak for review. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-07-16Refs #29824 -- Added RangeOperators helper class.Mads Jensen
2019-07-13Simplified RangeContainedBy by making it subclass PostgresSimpleLookup.Mariusz Felisiak
2019-07-12Simplified DateTimeRangeContains by making it subclass PostgresSimpleLookup.Mariusz Felisiak
2019-07-10Fixed #30621 -- Fixed crash of __contains lookup for Date/DateTimeRangeField ↵Mariusz Felisiak
when the right hand side is the same type. Thanks Tilman Koschnick for the report and initial patch. Thanks Carlton Gibson the review. Regression in 6b048b364ca1e0e56a0d3815bf2be33ac9998355.
2019-06-28Fixed #30400 -- Improved typography of user facing strings.Jon Dufresne
Thanks Claude Paroz for assistance with translations.
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