diff options
Diffstat (limited to 'django/db/backends/postgresql/psycopg_any.py')
-rw-r--r-- | django/db/backends/postgresql/psycopg_any.py | 3 |
1 files changed, 2 insertions, 1 deletions
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): |