We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9ae2a1 commit 8a0f4c0Copy full SHA for 8a0f4c0
pum/role_manager.py
@@ -54,6 +54,19 @@ def grant(
54
raise ValueError("Schemas must be defined for the permission.")
55
56
for schema in self.schemas:
57
+ # Detect if schema exists; if not, warn and continue
58
+ cursor = SqlContent("SELECT 1 FROM pg_namespace WHERE nspname = {schema}").execute(
59
+ connection=connection,
60
+ commit=False,
61
+ parameters={"schema": psycopg.sql.Literal(schema)},
62
+ )
63
+ if cursor.fetchone() is None:
64
+ logger.warning(
65
+ f"Schema {schema} does not exist; skipping grant of {self.type.value} "
66
+ f"permission to role {role}."
67
68
+ continue
69
+
70
logger.debug(
71
f"Granting {self.type.value} permission on schema {schema} to role {role}."
72
)
0 commit comments