MisterRaindrop commented on code in PR #2064:
URL: https://github.com/apache/cloudberry/pull/2064#discussion_r4144701400


##########
mcp-server/src/cbmcp/database.py:
##########
@@ -416,11 +416,11 @@ async def list_user_permissions(self, username: str) -> 
list[dict]:
                 "n.nspname as schema_name, "
                 "c.relname as object_name, "
                 "c.relkind as object_type, "
-                "p.perm as permission "
+                "p.privilege_type as permission "
                 "FROM pg_class c "
                 "JOIN pg_namespace n ON n.oid = c.relnamespace "
                 "CROSS JOIN LATERAL aclexplode(c.relacl) p "
-                "WHERE p.grantee = (SELECT oid FROM pg_user WHERE usename = 
$1) "
+                "WHERE p.grantee = (SELECT usesysid FROM pg_user WHERE usename 
= $1) "

Review Comment:
   Could we also handle a NULL `relacl` here? For a newly created table, 
`relacl` is normally NULL, which means the object has its default privileges 
rather than no privileges. `aclexplode(c.relacl)` therefore produces no rows, 
so this function can still report no permissions for the table owner.
   
   `information_schema.table_privileges` handles this with 
`aclexplode(coalesce(relacl, acldefault('r', relowner)))`. Could we apply 
equivalent handling here? It would also be helpful to clarify whether this 
function is intended to return only direct grants or effective permissions 
including `PUBLIC` and inherited role privileges.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to