diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2022-12-01 20:23:43 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-12-15 06:17:57 +0100 |
| commit | 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca (patch) | |
| tree | 15bb8bb049f9339f30d637e78b340473c2038126 /docs/ref/databases.txt | |
| parent | d44ee518c4c110af25bebdbedbbf9fba04d197aa (diff) | |
Fixed #33308 -- Added support for psycopg version 3.
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>
Diffstat (limited to 'docs/ref/databases.txt')
| -rw-r--r-- | docs/ref/databases.txt | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 79b0386e1a..d62adbe832 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -114,11 +114,21 @@ below for information on how to set up your database correctly. PostgreSQL notes ================ -Django supports PostgreSQL 12 and higher. `psycopg2`_ 2.8.4 or higher is -required, though the latest release is recommended. +Django supports PostgreSQL 12 and higher. `psycopg`_ 3.1+ or `psycopg2`_ 2.8.4+ +is required, though the latest `psycopg`_ 3.1+ is recommended. +.. _psycopg: https://www.psycopg.org/psycopg3/ .. _psycopg2: https://www.psycopg.org/ +.. note:: + + Support for ``psycopg2`` is likely to be deprecated and removed at some + point in the future. + +.. versionchanged:: 4.2 + + Support for ``psycopg`` 3.1+ was added. + .. _postgresql-connection-settings: PostgreSQL connection settings @@ -199,12 +209,12 @@ level`_. If you need a higher isolation level such as ``REPEATABLE READ`` or ``SERIALIZABLE``, set it in the :setting:`OPTIONS` part of your database configuration in :setting:`DATABASES`:: - import psycopg2.extensions + from django.db.backends.postgresql.psycopg_any import IsolationLevel DATABASES = { # ... 'OPTIONS': { - 'isolation_level': psycopg2.extensions.ISOLATION_LEVEL_SERIALIZABLE, + 'isolation_level': IsolationLevel.SERIALIZABLE, }, } @@ -216,6 +226,10 @@ configuration in :setting:`DATABASES`:: .. _isolation level: https://www.postgresql.org/docs/current/transaction-iso.html +.. versionchanged:: 4.2 + + ``IsolationLevel`` was added. + Indexes for ``varchar`` and ``text`` columns -------------------------------------------- @@ -244,7 +258,7 @@ Server-side cursors When using :meth:`QuerySet.iterator() <django.db.models.query.QuerySet.iterator>`, Django opens a :ref:`server-side -cursor <psycopg2:server-side-cursors>`. By default, PostgreSQL assumes that +cursor <psycopg:server-side-cursors>`. By default, PostgreSQL assumes that only the first 10% of the results of cursor queries will be fetched. The query planner spends less time planning the query and starts returning results faster, but this could diminish performance if more than 10% of the results are |
