更改Postgres数据库对象的默认权限后,如何查看它们?

例如,如果您将在模式schema_name中创建的所有表的所有权限授予role_name:

ALTER DEFAULT PRIVILEGES IN SCHEMA schema_name GRANT ALL ON TABLES TO role_name;

推荐答案

使用SQL查询

SELECT 
  nspname,         -- schema name
  defaclobjtype,   -- object type
  defaclacl        -- default access privileges
FROM pg_default_acl a JOIN pg_namespace b ON a.defaclnamespace=b.oid;

其中defaclobjtype的值是r = relation (table, view), S = sequence, f = function.

这些访问权限仅适用于架构命名空间中新创建的对象.

Postgresql相关问答推荐

将几个左连接合并为一个

Postgres SQL执行加入

Postgis超过2个表的查询在运行时爆炸

Postgres将唯一索引添加到已在分区上具有PK的分区表中,然后添加PK

为什么Postgres在打印时能完全缩短时间跨度?

PostgreSQL无效语法

在rust中,有什么方法可以从sqlx::query_with中返回rows_infected以及行本身?

在 Age Viewer 上看不到 node 的第一个属性

是否可以短时间运行 VACUUM FULL 并获得一些好处?

使用间隔参数的 go postgres 准备好的语句不起作用

PostgreSQL 输入结束时的语法错误

postgres 和 python

获取带有时区偏移的日期

Postgres 在 WHERE id != int 查询中排除 NULL

Psycopg2 使用占位符插入表格

PostgreSQL:使用 psql 命令行实用程序时 Windows 上的编码问题

在 postgresql 中,如何在 jsonb 键上返回布尔值而不是字符串?

在 postgresql 中将 bool 转换为 int

Windows 上的 GeoDjango:Could not find the GDAL library" / "OSError: [WinError 126] The specified module could not be found

PostgreSQL:从转储中恢复数据库 - 语法错误