mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
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>
This commit is contained in:
parent
c8a76059ff
commit
0e2649fdf4
6 changed files with 92 additions and 6 deletions
|
@ -277,6 +277,25 @@ class Tests(TestCase):
|
|||
finally:
|
||||
new_connection.close()
|
||||
|
||||
@unittest.skipUnless(is_psycopg3, "psycopg3 specific test")
|
||||
def test_connect_server_side_binding(self):
|
||||
"""
|
||||
The server-side parameters binding role can be enabled with DATABASES
|
||||
["OPTIONS"]["server_side_binding"].
|
||||
"""
|
||||
from django.db.backends.postgresql.base import ServerBindingCursor
|
||||
|
||||
new_connection = connection.copy()
|
||||
new_connection.settings_dict["OPTIONS"]["server_side_binding"] = True
|
||||
try:
|
||||
new_connection.connect()
|
||||
self.assertEqual(
|
||||
new_connection.connection.cursor_factory,
|
||||
ServerBindingCursor,
|
||||
)
|
||||
finally:
|
||||
new_connection.close()
|
||||
|
||||
def test_connect_no_is_usable_checks(self):
|
||||
new_connection = connection.copy()
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue