summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/base.py
AgeCommit message (Collapse)Author
2026-04-30Fixed #37075 -- Allowed overriding the PostgreSQL pool's "check" callable.HEADmaininitial-branchRaoni Timo
Setting "check" in OPTIONS["pool"] previously raised TypeError because the PostgreSQL backend always passed check= to ConnectionPool() and unpacked **pool_options on top, regardless of CONN_HEALTH_CHECKS. The user's callable now takes precedence via setdefault(); pool_options is copied first to avoid mutating the user's settings dict.
2025-11-17Fixed #24920 -- Added support for DecimalField with no precision.Mariusz Felisiak
Thanks Lily for the review.
2025-11-14Refs #24928 -- Added introspection support for PostgreSQL HStoreField.Mariusz Felisiak
2025-08-12Remove unused OneToOneField from DatabaseWrapper.data_types.Tim Graham
OneToOneField uses the type of the related field.
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-01-28Refs #36005 -- Bumped minimum supported versions of 3rd-party packages.Mariusz Felisiak
This bumps minimum supported versions of 3rd-party packages to the first releases to support Python 3.12.
2024-08-28Fixed #35688 -- Restored timezone and role setters to be PostgreSQL ↵Sarah Boyce
DatabaseWrapper methods. Following the addition of PostgreSQL connection pool support in Refs #33497, the methods for configuring the database role and timezone were moved to module-level functions. This change prevented subclasses of DatabaseWrapper from overriding these methods as needed, for example, when creating wrappers for other PostgreSQL-based backends. Thank you Christian Hardenberg for the report and to Florian Apolloner and Natalia Bidart for the review. Regression in fad334e1a9b54ea1acb8cce02a25934c5acfe99f. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-03-01Refs #33497 -- Added connection pool support for PostgreSQL.Sarah Boyce
Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-02-26Refs #34200 -- Removed unnecessary check in DatabaseWrapper.ensure_role() on ↵Florian Apolloner
PostgreSQL. ensure_role() is only called in init_connection_state() where a new connection is established.
2024-02-23Simplified using DATABASES["OPTIONS"].Florian Apolloner
DATABASES["OPTIONS"] are always configured.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2024-01-12Fixed #35028 -- Disabled server-side bindings for named cursors on psycopg >= 3.Simon Charette
While we provide a `cursor_factory` based on the value of the `server_side_bindings` option to `psycopg.Connection` it is ignored by the `cursor` method when `name` is specified for `QuerySet.iterator()` usage and it causes the usage of `psycopg.ServerCursor` which performs server-side bindings. Since the ORM doesn't generates SQL that is suitable for server-side bindings when dealing with parametrized expressions a specialized cursor must be used to allow server-side cursors to be used with client-side bindings. Thanks Richard Ebeling for the report. Thanks Florian Apolloner and Daniele Varrazzo for reviews.
2023-04-07Fixed #34470 -- Enforced UTF-8 encoding on PostgreSQL.Mariusz Felisiak
Regression in 6a2165816394ab4bb259f6171e82417e098e97a6.
2023-04-07Fixed #34466 -- Reallowed setting cursor_factory in DATABASES["options"] on ↵Anders Kaseorg
PostgreSQL. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
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-01-17Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding ↵Mariusz Felisiak
with psycopg version 3. Thanks Guillaume Andreu Sabater for the report. Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
2023-01-17Refs #34255 -- Bumped required psycopg version to 3.1.8.Mariusz Felisiak
2023-01-03Fixed #34200 -- Made the session role configurable on PostgreSQL.Mike Crute
2022-12-28Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.Adrian Torres
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
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 psycopg_any.IsolationLevel.Florian Apolloner
2022-12-06Refs #33308 -- Modernized database wrapper in the PostgreSQL backend.Florian Apolloner
- Used connection.info instead of connection.get_parameter_status() and connection.server_info which don't exist in psycopg 3. - Set encoding using the client_encoding connection parameter instead of connection.set_client_encoding() that doesn't exist in psycopg 3. - Used the dbname connection parameter instead of deprecated alias - database.
2022-04-13Fixed #30511 -- Used identity columns instead of serials on PostgreSQL.Florian Apolloner
2022-02-18Fixed #33379 -- Added minimum database version checks.Hasan Ramezani
Thanks Tim Graham for the review.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-12-22Refs #32355 -- Bumped required psycopg2 version to 2.8.4.Mariusz Felisiak
psycopg2 2.8.4 is the first release to support Python 3.8.
2021-10-01Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on ↵Daniel Hahler
PostgreSQL.
2021-02-10Fixed #32355 -- Dropped support for Python 3.6 and 3.7Mariusz Felisiak
2021-02-02Fixed #32403 -- Fixed re-raising DatabaseErrors when using only 'postgres' ↵Mariusz Felisiak
database. Thanks Kazantcev Andrey for the report. Regression in f48f671223a20b161ca819cf7d6298e43b8ba5fe.
2021-01-20Fixed #32292 -- Added support for connection by service name to PostgreSQL.Hasan Ramezani
2021-01-14Refs #31369 -- Removed models.NullBooleanField per deprecation timeline.Mariusz Felisiak
2020-11-19Fixed #32201 -- Removed obsolete isort:skip's.Seamus Quinn
Obsolete as of isort 5.
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-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-02-06Fixed #31233 -- Closed database connections and cursors after use.Jon Dufresne
2020-02-06Refs #31233 -- Changed DatabaseWrapper._nodb_connection to _nodb_cursor().Jon Dufresne
It is now a method instead of a property and returns a context manager that yields a cursor on entry and closes the cursor and connection upon exit.
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-01-29Fixed #31212 -- Updated psycopg links to HTTPS and new location.Jon Dufresne
2019-12-04Fixed #23524 -- Allowed DATABASES['TIME_ZONE'] option on PostgreSQL.Aymeric Augustin
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-08-02Fixed #30661 -- Added models.SmallAutoField.Nick Pope
2019-06-20Fixed #30451 -- Added ASGI handler and coroutine-safety.Andrew Godwin
This adds an ASGI handler, asgi.py file for the default project layout, a few async utilities and adds async-safety to many parts of Django.
2019-04-29Fixed #30148 -- Logged COPY ... TO statements in connection.queries on ↵kingbuzzman
PostgreSQL.
2019-02-20Fixed #30193, Refs #28478 -- Avoided PostgreSQL connection health checks on ↵Simon Charette
initialization. This addressed a regression introduced by a96b9019320ed8236659ee520a7a017c1bafbc6f as identified by Ran Benita.
2019-02-14Fixed #30171 -- Fixed DatabaseError in servers tests.Jon Dufresne
Made DatabaseWrapper thread sharing logic reentrant. Used a reference counting like scheme to allow nested uses. The error appeared after 8c775391b78b2a4a2b57c5e89ed4888f36aada4b.
2019-02-06Refs #27753 -- Favored SafeString over SafeText.Tim Graham
2019-01-14Refs #28478 -- Prevented timezone assignment for unusable PostgreSQL ↵Simon Charette
connections.
2018-11-01Fixed #29886 -- Fixed unaccent lookup when PostgreSQL's ↵Jayantha Gumballi
standard_conforming_strings option is off. Thanks Tom McClure for the patch.
2018-08-17Refs #29015 -- Added database name to PostgreSQL database name too long ↵Jon Dufresne
exception.
2018-04-27Fixed #29015 -- Added an exception if the PostgreSQL database name is too long.priyanshsaxena