mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #21452 -- Non-autocommit connections to PostgreSQL.
When settings.DATABASES['default']['AUTOCOMMIT'] = False, the connection wasn't in autocommit mode but Django pretended it was. Thanks Anssi for analysing this issue. Refs #17062.
This commit is contained in:
@@ -142,11 +142,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
conn_tz = get_parameter_status('TimeZone')
|
||||
|
||||
if conn_tz != tz:
|
||||
# Set the time zone in autocommit mode (see #17062)
|
||||
self.set_autocommit(True)
|
||||
self.connection.cursor().execute(
|
||||
self.ops.set_time_zone_sql(), [tz]
|
||||
)
|
||||
# Commit after setting the time zone (see #17062)
|
||||
self.connection.commit()
|
||||
self.connection.set_isolation_level(self.isolation_level)
|
||||
|
||||
def create_cursor(self):
|
||||
|
||||
Reference in New Issue
Block a user