简体   繁体   English

如何为PostgreSQL中的特定表提供写权限?

[英]How to provide write permission for specific tables in PostgreSQL?

I have a user with read-only access in my PostgreSQL 11. How can I give them access to write/edit data in some of the database tables, eg Table1 and Table2 only?我的Table2中有一个用户具有只读访问权限 11. 我如何才能授予他们写入/编辑某些数据库表(例如,仅Table1 1 和表 2)中的数据的权限?

I don't want them to change the DB schema or table structure.我不希望他们更改数据库架构或表结构。

Use GRANT :使用GRANT

GRANT INSERT, UPDATE, DELETE ON table1 TO some_user;

You may want to read about basics of the Postgres privilege system in the manual .您可能想在手册中阅读有关 Postgres 特权系统的基础知识。 One essential quote:一个重要的报价:

The right to modify or destroy an object is inherent in being the object's owner, and cannot be granted or revoked in itself.修改或销毁 object 的权利是该对象的所有者所固有的,并且本身不能被授予或撤销。 (However, like all privileges, that right can be inherited by members of the owning role; see Section 22.3 .) (但是,与所有特权一样,该权利可以由拥有角色的成员继承;请参阅第 22.3 节。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM