SELECT *
FROM information_schema.role_authorization_descriptors
WHERE grantee = 'a_user';
更有用查询是检查用户是否有权访问表
SELECT *
FROM information_schema.table_privileges
WHERE table_schema = 'a_schema'
AND table_name = 'a_table'
AND privilege_type = 'SELECT'
AND (grantee = 'a_user' OR grantee IN (SELECT role_name
FROM information_schema.role_authorization_descriptors
WHERE grantee = 'a_user'));
1条答案
按热度按时间vzgqcmou1#
我们可以从
information_schema
中获得信息,这是不言自明的,但我找不到有关此系统定义模式的文档。更有用查询是检查用户是否有权访问表