1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #34200 -- Removed unnecessary check in DatabaseWrapper.ensure_role() on PostgreSQL.

ensure_role() is only called in init_connection_state() where a new
connection is established.
This commit is contained in:
Florian Apolloner 2024-02-26 10:53:47 +01:00 committed by Mariusz Felisiak
parent 977d254169
commit 18d79033b9

View File

@ -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])