Fixed #26177 -- Fixed a PostgreSQL crash with TIME_ZONE=None and USE_TZ=False.
This commit is contained in:
parent
e000ca23d2
commit
97eb3356b2
|
@ -197,7 +197,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
|
|
||||||
conn_timezone_name = self.connection.get_parameter_status('TimeZone')
|
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()
|
cursor = self.connection.cursor()
|
||||||
try:
|
try:
|
||||||
cursor.execute(self.ops.set_time_zone_sql(), [self.timezone_name])
|
cursor.execute(self.ops.set_time_zone_sql(), [self.timezone_name])
|
||||||
|
|
|
@ -69,7 +69,7 @@ def update_connections_time_zone(**kwargs):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
tz_sql = conn.ops.set_time_zone_sql()
|
tz_sql = conn.ops.set_time_zone_sql()
|
||||||
if tz_sql:
|
if tz_sql and conn.timezone_name:
|
||||||
with conn.cursor() as cursor:
|
with conn.cursor() as cursor:
|
||||||
cursor.execute(tz_sql, [conn.timezone_name])
|
cursor.execute(tz_sql, [conn.timezone_name])
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,5 @@ Django 1.8.10 fixes several bugs in 1.8.9.
|
||||||
Bugfixes
|
Bugfixes
|
||||||
========
|
========
|
||||||
|
|
||||||
* ...
|
* Fixed a crash on PostgreSQL that prevented using ``TIME_ZONE=None`` and
|
||||||
|
``USE_TZ=False`` (:ticket:`26177`).
|
||||||
|
|
|
@ -11,3 +11,6 @@ Bugfixes
|
||||||
|
|
||||||
* Skipped URL checks (new in 1.9) if the ``ROOT_URLCONF`` setting isn't defined
|
* Skipped URL checks (new in 1.9) if the ``ROOT_URLCONF`` setting isn't defined
|
||||||
(:ticket:`26155`).
|
(:ticket:`26155`).
|
||||||
|
|
||||||
|
* Fixed a crash on PostgreSQL that prevented using ``TIME_ZONE=None`` and
|
||||||
|
``USE_TZ=False`` (:ticket:`26177`).
|
||||||
|
|
|
@ -825,6 +825,11 @@ class BackendTestCase(TransactionTestCase):
|
||||||
BaseDatabaseWrapper.queries_limit = old_queries_limit
|
BaseDatabaseWrapper.queries_limit = old_queries_limit
|
||||||
new_connection.close()
|
new_connection.close()
|
||||||
|
|
||||||
|
def test_timezone_none_use_tz_false(self):
|
||||||
|
connection.ensure_connection()
|
||||||
|
with self.settings(TIME_ZONE=None, USE_TZ=False):
|
||||||
|
connection.init_connection_state()
|
||||||
|
|
||||||
|
|
||||||
# We don't make these tests conditional because that means we would need to
|
# We don't make these tests conditional because that means we would need to
|
||||||
# check and differentiate between:
|
# check and differentiate between:
|
||||||
|
|
Loading…
Reference in New Issue