mirror of
https://github.com/django/django.git
synced 2025-03-13 02:40:47 +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:
parent
977d254169
commit
18d79033b9
@ -296,8 +296,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def ensure_role(self):
|
def ensure_role(self):
|
||||||
if self.connection is None:
|
|
||||||
return False
|
|
||||||
if new_role := self.settings_dict["OPTIONS"].get("assume_role"):
|
if new_role := self.settings_dict["OPTIONS"].get("assume_role"):
|
||||||
with self.connection.cursor() as cursor:
|
with self.connection.cursor() as cursor:
|
||||||
sql = self.ops.compose_sql("SET ROLE %s", [new_role])
|
sql = self.ops.compose_sql("SET ROLE %s", [new_role])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user