diff --git a/k8s-itlabs-operator/clients/postgres/postgresclient.py b/k8s-itlabs-operator/clients/postgres/postgresclient.py index 5661b9b..ce82f8b 100644 --- a/k8s-itlabs-operator/clients/postgres/postgresclient.py +++ b/k8s-itlabs-operator/clients/postgres/postgresclient.py @@ -122,12 +122,13 @@ def is_user_grantee(self, database: str, user: str) -> bool: UNION SELECT 1 FROM pg_default_acl acl - join pg_namespace namespace on namespace.oid = acl.defaclnamespace - WHERE acl.defaclacl::text ILIKE %s; + JOIN pg_namespace namespace on namespace.oid = acl.defaclnamespace + WHERE acl.defaclacl::text ILIKE %s + AND acl.defaclacl::text ILIKE %s; """ return bool(self._execute_query_v2( query, - values=[user, database, f"%{user}=r/{database}%"], + values=[user, database, f"%{user}%", f"%{database}%"], )) def is_database_exist(self, db_name: str) -> bool: