
# 如何查看某个用户有哪些表的权限？
答：可使用information_schema.table_privileges系统视图查看。
```
--查询jim用户有哪些表的权限。
gaussdb=# SELECT * FROM information_schema.table_privileges WHERE grantee = 'jim';
 grantor | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy 
---------+---------+---------------+--------------+------------+----------------+--------------+----------------
 jim     | jim     | postgres      | jim          | reason     | INSERT         | YES          | NO
 jim     | jim     | postgres      | jim          | reason     | SELECT         | YES          | YES
 jim     | jim     | postgres      | jim          | reason     | UPDATE         | YES          | NO
 jim     | jim     | postgres      | jim          | reason     | DELETE         | YES          | NO
 jim     | jim     | postgres      | jim          | reason     | TRUNCATE       | YES          | NO
 jim     | jim     | postgres      | jim          | reason     | REFERENCES     | YES          | NO
 jim     | jim     | postgres      | jim          | reason     | TRIGGER        | YES          | NO
(7 rows)
```
系统视图information_schema.table_privileges字段如[表1]所示。
 表1table_privileges字段说明 
| 字段             | 数据类型                              | 描述                                                                                          |
|:---|:---|:---|
| grantor        | information_schema.sql_identifier | 赋权用户。                                                                                       |
| grantee        | information_schema.sql_identifier | 被赋权用户。                                                                                      |
| table_catalog  | information_schema.sql_identifier | 包含该表的数据库名。                                                                                  |
| table_schema   | information_schema.sql_identifier | 包含该表的模式名。                                                                                   |
| table_name     | information_schema.sql_identifier | 表名。                                                                                         |
| privilege_type | information_schema.character_data | 被赋予的权限类型：SELECT、INSERT、UPDATE、DELETE、TRUNCATE、REFERENCES、ANALYZE、VACUUM、ALTER、DROP或TRIGGER。 |
| is_grantable   | information_schema.yes_or_no      | 权限是否可赋予其他用户，YES表示可赋予，NO表示不可赋予。                                                              |
| with_hierarchy | information_schema.yes_or_no      | 是否允许在表继承层级上的特定操作。当特定操作为SELECT时显示YES，否则为NO。                                                  |
   
