diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 96ba33a882..793a7bf3bc 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -296,8 +296,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): return False def ensure_role(self): - if self.connection is None: - return False if new_role := self.settings_dict["OPTIONS"].get("assume_role"): with self.connection.cursor() as cursor: sql = self.ops.compose_sql("SET ROLE %s", [new_role])