* status: closed => new
* severity: Normal => Release blocker
* cc: Florian Apolloner, Daniele Varrazzo (added)
* resolution: duplicate =>
* stage: Unreviewed => Accepted
Comment:
Great catch! We should ensure an active connection in `mogrify()` with
`psycopg` version 3, e.g.
{{{#!diff
diff --git a/django/db/backends/postgresql/psycopg_any.py
b/django/db/backends/postgresql/psycopg_any.py
index 579104dead..1fe6b15caf 100644
--- a/django/db/backends/postgresql/psycopg_any.py
+++ b/django/db/backends/postgresql/psycopg_any.py
@@ -18,7 +18,8 @@ try:
TSTZRANGE_OID = types["tstzrange"].oid
def mogrify(sql, params, connection):
- return ClientCursor(connection.connection).mogrify(sql, params)
+ with connection.cursor() as cursor:
+ return ClientCursor(cursor.connection).mogrify(sql, params)
# Adapters.
class BaseTzLoader(TimestamptzLoader):
}}}
Would you like to prepare a patch (via GitHub PR)? a regression test is
required.
--
Ticket URL: <https://code.djangoproject.com/ticket/34486#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.