admin管理员组文章数量:1296278
I'm trying to create a dedicated role/user in postgresql and I want to grant only the minium privileges for a schema inside a database, but I don't really understand how this works.
Of course I know I need to grant the connect privilege, but then things become somehow contorted when it comes to privileges on schemas only or on a certain schema and I'm not sure how the default privileges works in this case.
Ideally I would like to be able to have read-only access to all schemas in that particular database, but just one schema would suffice initially.
I also see that pg_dump --schema-only
implies temporarily locking the database, so I probably also need a privilege for that too.
I'm using postgresql 17.2.1 I'm looking forward to someone helping me :)
I'm trying to create a dedicated role/user in postgresql and I want to grant only the minium privileges for a schema inside a database, but I don't really understand how this works.
Of course I know I need to grant the connect privilege, but then things become somehow contorted when it comes to privileges on schemas only or on a certain schema and I'm not sure how the default privileges works in this case.
Ideally I would like to be able to have read-only access to all schemas in that particular database, but just one schema would suffice initially.
I also see that pg_dump --schema-only
implies temporarily locking the database, so I probably also need a privilege for that too.
I'm using postgresql 17.2.1 I'm looking forward to someone helping me :)
Share Improve this question asked Feb 12 at 9:41 LethargosLethargos 7327 silver badges16 bronze badges1 Answer
Reset to default 1For most PostgreSQL metadata, you don't need any special privileges to read them. So to dump those objects, all you need for a schema-only dump is the right to connect to the database.
In addition, pg_dump
puts an ACCESS SHARE
lock on all tables, so that they cannot be changed or removed while pg_dump
is at work.
The only catalog tables with restricted privileges are pg_authid
(roles), pg_largeobject
(large objects), pg_statistic
, pg_statistic_ext_data
(both contain optimizer statistics) and pg_subscription
(logical replication subscriptions). The only one that is relevant here is pg_subscription
, and in particular the column that contains the connect information to the publisher.
So I would say that unless you need a schema-only dump of a database with subscriptions in it, all you need is the SELECT
privilege on all the tables you want to dump and the USAGE
privilege on the schemas that contain these tables. It takes a superuser to dump subscriptions.
本文标签: backupminimum postgresql permissions for pgdump schemaonlyStack Overflow
版权声明:本文标题:backup - minimum postgresql permissions for pg_dump --schema-only - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741610930a2388253.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论