summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
AgeCommit message (Collapse)Author
2025-12-26Fixed #36112 -- Added fallback in last_executed_query() on Oracle and ↵VIZZARD-X
PostgreSQL.
2025-09-23Fixed #36616 -- Added DatabaseOperations.adapt_durationfield_value().Tim Graham
2025-08-28Refs #27222 -- Implemented ↵Simon Charette
BaseDatabaseOperations.return_insert_columns()/fetch_returned_insert_rows().
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.
2024-12-11Fixed #35936 -- Used unnest for bulk inserts on Postgres when possible.Simon Charette
This should make bulk_create significantly faster on Postgres when provided only literal values. Thanks James Sewell for writing about this technique, Tom Forbes for validating the performance benefits, David Sanders and Mariusz Felisiak for the review.
2024-12-09Refs #35982 -- Made BaseDatabaseOperations.adapt_decimalfield_value() a no-op.Simon Charette
2024-10-30Fixed #35856 -- Added QuerySet.explain() support for MEMORY/SERIALIZE option ↵Anthony Joseph
on PostgreSQL 17+.
2024-03-14Refs #35295 -- Added BaseDatabaseOperations.bulk_insert_sql().Mariusz Felisiak
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2024-03-06Fixed #35021 -- Fixed capturing queries when using client-side parameters ↵Michail Chatzis
binding with psycopg 3+.
2023-09-26Fixed #34873 -- Added QuerySet.explain() support for GENERIC_PLAN option on ↵Mariusz Felisiak
PostgreSQL 16+.
2023-09-22Fixed #34840 -- Avoided casting string base fields on PostgreSQL.Mariusz Felisiak
Thanks Alex Vandiver for the report. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
2023-09-18Refs #33872 -- Removed ↵Mariusz Felisiak
django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField. Per deprecation timeline.
2023-04-18Fixed #16055 -- Fixed crash when filtering against char/text GenericRelation ↵David Wobrock
relation on PostgreSQL.
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 -- Added DatabaseOperations.compose_sql() on PostgreSQL.Florian Apolloner
2022-12-12Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner
2022-11-15Refs #33308 -- Used get_db_prep_value() to adapt JSONFields.Simon Charette
2022-08-03Fixed #33872 -- Deprecated ↵Mariusz Felisiak
django.contrib.postgres.fields.CIText/CICharField/CIEmailField/CITextField.
2022-07-06Refs CVE-2022-34265 -- Properly escaped Extract() and Trunc() parameters.Simon Charette
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-04-14Removed unneeded code in explain_query_prefix()Tim Graham
2022-04-11Fixed CVE-2022-28347 -- Protected QuerySet.explain(**options) against SQL ↵Mariusz Felisiak
injection on PostgreSQL.
2022-02-22Refs #33517 -- Prevented __second lookup from returning fractional seconds ↵nabil-rady
on PostgreSQL.
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
2022-01-19Fixed #31685 -- Added support for updating conflicts to QuerySet.bulk_create().sean_c_hsu
Thanks Florian Apolloner, Chris Jerdonek, Hannes Ljungberg, Nick Pope, and Mariusz Felisiak for reviews.
2021-11-12Fixed #33279 -- Fixed handling time zones with "-" sign in names.Can Sarigol
Thanks yakimka for the report. Regression in fde9b7d35e4e185903cc14aa587ca870037941b1.
2020-10-14Fixed #31640 -- Made Trunc() truncate datetimes to Date/TimeField in a ↵David-Wobrock
specific timezone.
2020-08-28Fixed #31956 -- Fixed crash of ordering by JSONField with a custom decoder ↵Mariusz Felisiak
on PostgreSQL. Thanks Marc Debureaux for the report. Thanks Simon Charette, Nick Pope, and Adam Johnson for reviews.
2020-07-17Fixed #31731 -- Removed unreachable code for resetting sequences of ↵Ravindar Sharma
auto-created m2m tables in sequence_reset_sql(). Unreachable because f.remote_field.through is truthy for all m2m fields. Resetting sequences of auto-created m2m tables in sequence_reset_sql() is also unnecessary: - in sqlsequencereset since c39ec6dccb389fbb4047e44f5247e18bb76ae598 because auto-created tables are included in model_list, - in loaddata because there is no it need to reset sequences for models not loaded directly. - in create_default_site() because it doesn't have m2m fields.
2020-07-14Stopped adapting DecimalField values to strings on PostgreSQL.Simon Charette
The psycopg2 backend uses the type information to provide type hints.
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-17Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on ↵Jon Dufresne
PostgreSQL. The sql_flush() positional argument sequences is replaced by the boolean keyword-only argument reset_sequences. This ensures that the old function signature can't be used by mistake when upgrading Django. When the new argument is True, the sequences of the truncated tables will reset. Using a single boolean value, rather than a list, allows making a binary yes/no choice as to whether to reset all sequences rather than a working on a completely different set.
2020-04-17Simplified DatabaseOperations.sql_flush() on Oracle and PostgreSQL.Jon Dufresne
Added early return to decrease an indentation level.
2020-01-29Fixed #31212 -- Updated psycopg links to HTTPS and new location.Jon Dufresne
2020-01-20Fixed #31183 -- Added a feature flag for "<db> only supports UNBOUNDED ↵Tim Graham
together with PRECEDING and FOLLOWING".
2020-01-03Fixed #31133 -- Fixed crash when subtracting against a subquery annotation.Simon Charette
The subtract_temporals() database operation was not handling expressions returning SQL params in mixed database types. Regression in 35431298226165986ad07e91f9d3aca721ff38ec. Thanks Reupen Shah for the report.
2019-10-02Fixed #30821 -- Added ExtractIsoWeekYear database function and iso_week_day ↵Anatol Ulrich
lookup.
2019-09-09Refs #29444 -- Allowed returning multiple fields from INSERT statements on ↵Johannes Hoppe
PostgreSQL. Thanks Florian Apolloner, Tim Graham, Simon Charette, Nick Pope, and Mariusz Felisiak for reviews.
2019-08-02Fixed #30661 -- Added models.SmallAutoField.Nick Pope
2019-07-08Refs #29444 -- Added support for fetching a returned non-integer insert ↵Johannes Hoppe
values on Oracle. This is currently not actively used, since the ORM will ask the SQL compiler to only return auto fields.
2019-06-13Fixed #30128 -- Fixed handling timedelta timezone in database functions.can
2019-03-29Removed unnecessary /static from links to PostgreSQL docs.Nick Pope
2018-08-18Fixed #28649 -- Added ExtractIsoYear database function and iso_year lookup.Sigurd Ljødal
2018-08-03Fixed #28668 -- Allowed QuerySet.bulk_create() to ignore insert conflicts.Tom
2018-07-25Fixed #29569 -- Fixed Cast() with AutoField and BigAutoField.Mariusz Felisiak
2018-04-19Fixed #28574 -- Added QuerySet.explain().Tom
2018-02-10Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).Matthew Wilkes
2018-01-03Fixed #28982 -- Simplified code with and/or.Дилян Палаузов
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-11-29Fixed #28702 -- Made query lookups for CIText fields use citext.Mads Jensen