1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Fixed #34486 -- Fixed DatabaseOperations.compose_sql() crash with no existing database connection on PostgreSQL.

Regression in 09ffc5c121.
This commit is contained in:
Scott Macpherson
2023-04-13 21:07:32 +10:00
committed by Mariusz Felisiak
parent 813015d67e
commit 53aee470d5
3 changed files with 16 additions and 1 deletions

View File

@@ -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):