From 29e6241feb554e888630643c0984fb5e1000f4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Clgen=20Sar=C4=B1kavak?= Date: Mon, 3 Nov 2025 12:23:56 +0300 Subject: [PATCH] Bump psycopg to 3.1.8+ (#9815) The earliest supported Django version 4.2 recommends using psycopg>=3.1.8 https://docs.djangoproject.com/en/4.2/ref/databases/#postgresql-notes --- requirements/requirements-optionals.txt | 2 +- rest_framework/compat.py | 2 +- tests/test_serializer_nested.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index bac597c95..b0d0840f4 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -5,6 +5,6 @@ django-filter django-guardian>=2.4.0,<2.5 inflection==0.5.1 markdown>=3.3.7 -psycopg2-binary>=2.9.5,<2.10 +psycopg[binary]>=3.1.8 pygments~=2.17.0 pyyaml>=5.3.1,<5.4 diff --git a/rest_framework/compat.py b/rest_framework/compat.py index ff21bacff..6651d80af 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -16,7 +16,7 @@ def unicode_http_header(value): return value -# django.contrib.postgres requires psycopg2 +# django.contrib.postgres requires psycopg try: from django.contrib.postgres import fields as postgres_fields except ImportError: diff --git a/tests/test_serializer_nested.py b/tests/test_serializer_nested.py index b7195494c..5e42645eb 100644 --- a/tests/test_serializer_nested.py +++ b/tests/test_serializer_nested.py @@ -315,7 +315,7 @@ if postgres_fields: required_db_features = {'supports_json_field'} -@pytest.mark.skipif(not postgres_fields, reason='psycopg2 is not installed') +@pytest.mark.skipif(not postgres_fields, reason='psycopg is not installed') class TestNestedNonRelationalFieldWrite: """ Test that raise_errors_on_nested_writes does not raise `AssertionError` when the