租户端 数据库 TDSQL PostgreSQL 版 开发指南 列出表、视图和序列和它们相关的访问权限

列出表、视图和序列和它们相关的访问权限

最近更新时间: 2024-10-17 17:10:00

  • 显示所有对象的访问权限。
postgres=# \dp
                                     Accessprivileges
 Schema |       Name        |   Type  | Access privileges | Column privileges | Policies 
--------+--------------------+----------+-------------------+-------------------+----------
 public | pg_stat_statements | view     | tbase=arwdDxt/tbase+|                   | 
       |                    |          | =r/tbase           |                   | 
 public | tbase              | table    | tbase=arwdDxt/tbase+|                   | 
       |                    |          | pgxc=r/tbase       |                   | 
 public | tbase_seq          | sequence | tbase=rwU/tbase    +|                   | 
       |                    |          | pgxc=rwU/tbase     |                  | 
(3 rows) 
  • \dp+某个对象名,只显示匹配的对象。
postgres=# \dp tbase
                                     Accessprivileges
 Schema |       Name        |   Type  | Access privileges | Column privileges | Policies 
--------+-------+-------+-------------------+-------------------+----------
 public | tbase              | table    | tbase=arwdDxt/tbase+|                   | 
       |                    |          | pgxc=r/tbase       |                   | 
(1 row)

postgres=# \dp public.*
                                     Accessprivileges
 Schema |       Name        |   Type  | Access privileges | Column privileges | Policies 
--------+--------------------+----------+-------------------+-------------------+----------
 public | pg_stat_statements | view     | tbase=arwdDxt/tbase+|                   | 
       |                    |          | =r/tbase           |                   | 
 public | tbase              | table    | tbase=arwdDxt/tbase+|                   | 
       |                    |          | pgxc=r/tbase       |                   | 
 public | tbase_seq          | sequence | tbase=rwU/tbase    +|                   | 
       |                    |          | pgxc=rwU/tbase     |                  | 
(3 rows)