pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。
当你创建一个数据库对象时,你就成为它的 所有者。默认情况下,只有对象的所有者才能对 对象做任何操作。为了让其他用户能够使用它, 必须授予权限。(也有一些 用户拥有超级用户权限。这些用户总是 可以访问任何对象。)
要更改表、索引、序列或视图的所有者,请使用 ALTER TABLE 命令。
有多种不同的权限:SELECT、 INSERT、UPDATE、DELETE、 RULE、REFERENCES、TRIGGER、 CREATE、TEMPORARY、EXECUTE、 USAGE 和 ALL PRIVILEGES。关于 PostgreSQL 支持的各 种权限类型的完整信息,请参阅 GRANT 参考页。后面的各节 和各章还会向你展示这些权限是如何使用的。
修改或销毁对象的权利始终只属于该对象的拥有者。
要分配权限,使用 GRANT 命令。 used. So, if joe is an existing user, and accounts is an existing table, the privilege to update the table can be granted with
GRANT UPDATE ON accounts TO joe;
The user executing this command must be the owner of the table. To grant a privilege to a group, use
GRANT SELECT ON accounts TO GROUP staff;
The special “user” name PUBLIC can be used to grant a privilege to every user on the system. Writing ALL in place of a specific privilege specifies that all privileges will be granted.
要收回权限,使用名字同样贴切的 REVOKE command:
REVOKE ALL ON accounts FROM PUBLIC;
The special privileges of the table owner (i.e., the right to do DROP, GRANT, REVOKE, etc) are always implicit in being the owner, and cannot be granted or revoked. But the table owner can choose to revoke his own ordinary privileges, for example to make a table read-only for himself as well as others.
译文有误、术语不当或页面显示问题,请到译文仓库 pgsty/pgdoc 报告译文问题。 英文原文本身的问题,请在当前版本的对应页面向上游反馈;上游不再修订已结束维护的版本。