summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/postgresql/base.py2
-rw-r--r--django/test/signals.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index 7822c66327..2f3b00bfb6 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -197,7 +197,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
conn_timezone_name = self.connection.get_parameter_status('TimeZone')
- if conn_timezone_name != self.timezone_name:
+ if self.timezone_name and conn_timezone_name != self.timezone_name:
cursor = self.connection.cursor()
try:
cursor.execute(self.ops.set_time_zone_sql(), [self.timezone_name])
diff --git a/django/test/signals.py b/django/test/signals.py
index 1a86b1f846..e9ba517073 100644
--- a/django/test/signals.py
+++ b/django/test/signals.py
@@ -69,7 +69,7 @@ def update_connections_time_zone(**kwargs):
except AttributeError:
pass
tz_sql = conn.ops.set_time_zone_sql()
- if tz_sql:
+ if tz_sql and conn.timezone_name:
with conn.cursor() as cursor:
cursor.execute(tz_sql, [conn.timezone_name])