summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt24
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