summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-16 10:22:02 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-17 08:24:08 +0100
commit0e2649fdf40cedc5be7e2c0e5f7711f315e36b84 (patch)
treee970a4cd9f3bd3d26f888c7c1342af753b440dcf /docs/ref/databases.txt
parentc8a76059ff6ff37fb51972fe2ba8b9d9464af769 (diff)
Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding with psycopg version 3.
Thanks Guillaume Andreu Sabater for the report. Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt31
1 files changed, 28 insertions, 3 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 2dbf71562f..6755085336 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -117,9 +117,6 @@ PostgreSQL notes
Django supports PostgreSQL 12 and higher. `psycopg`_ 3.1.8+ or `psycopg2`_
2.8.4+ is required, though the latest `psycopg`_ 3.1.8+ 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
@@ -251,6 +248,31 @@ database configuration in :setting:`DATABASES`::
},
}
+.. _database-server-side-parameters-binding:
+
+Server-side parameters binding
+------------------------------
+
+.. versionadded:: 4.2
+
+With `psycopg`_ 3.1.8+, Django defaults to the :ref:`client-side binding
+cursors <psycopg:client-side-binding-cursors>`. If you want to use the
+:ref:`server-side binding <psycopg:server-side-binding>` set it in the
+:setting:`OPTIONS` part of your database configuration in
+:setting:`DATABASES`::
+
+ DATABASES = {
+ "default": {
+ "ENGINE": "django.db.backends.postgresql",
+ # ...
+ "OPTIONS": {
+ "server_side_binding": True,
+ },
+ },
+ }
+
+This option is ignored with ``psycopg2``.
+
Indexes for ``varchar`` and ``text`` columns
--------------------------------------------
@@ -373,6 +395,9 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
a development machine where you can easily restore the entire contents of
all databases in the cluster.
+.. _psycopg: https://www.psycopg.org/psycopg3/
+.. _psycopg2: https://www.psycopg.org/
+
.. _mariadb-notes:
MariaDB notes