summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/base.py
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2019-02-20 04:59:40 -0500
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-02-20 10:59:40 +0100
commit7071f8f2729295b0da77b6c651966dc32c71f1ab (patch)
tree9e9c46abec3a2b6b1dbc698c37c483d43785b6c6 /django/db/backends/postgresql/base.py
parentedec11ce86a1a0d9e4c5a2a0df6acaf655041c24 (diff)
downloaddjango-7071f8f2729295b0da77b6c651966dc32c71f1ab.tar.gz
Fixed #30193, Refs #28478 -- Avoided PostgreSQL connection health checks on initialization.
This addressed a regression introduced by a96b9019320ed8236659ee520a7a017c1bafbc6f as identified by Ran Benita.
Diffstat (limited to 'django/db/backends/postgresql/base.py')
-rw-r--r--django/db/backends/postgresql/base.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index b3a3202c90..250691aeda 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -195,7 +195,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
return connection
def ensure_timezone(self):
- if not self.is_usable():
+ if self.connection is None:
return False
conn_timezone_name = self.connection.get_parameter_status('TimeZone')
timezone_name = self.timezone_name
@@ -208,7 +208,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def init_connection_state(self):
self.connection.set_client_encoding('UTF8')
- self.ensure_connection()
timezone_changed = self.ensure_timezone()
if timezone_changed:
# Commit after setting the time zone (see #17062)
@@ -248,8 +247,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
self.cursor().execute('SET CONSTRAINTS ALL DEFERRED')
def is_usable(self):
- if self.connection is None:
- return False
try:
# Use a psycopg cursor directly, bypassing Django's utilities.
self.connection.cursor().execute("SELECT 1")