给用户赋予表的权限
-- 赋予 SELECT 权限 GRANT SELECT ON TABLE table_name TO username; -- 赋予 INSERT, UPDATE, DELETE 权限 GRANT INSERT, UPDATE, DELETE ON TABLE table_name TO username; -- 赋予所有权限 GRANT ALL PRIVILEGES ON TABLE table_name TO username;
给用户赋予数据库的权限
-- 赋予 CREATE 权限 GRANT CREATE ON DATABASE database_name TO username; -- 赋予 CONNECT 权限 GRANT CONNECT ON DATABASE database_name TO username; -- 赋予所有权限 GRANT ALL PRIVILEGES ON DATABASE database_name TO username;
给用户赋予模式的权限
-- 赋予 USAGE 权限(即在该模式下创建对象) GRANT USAGE ON SCHEMA schema_name TO username; -- 赋予 CREATE 权限 GRANT CREATE ON SCHEMA schema_name TO username; -- 赋予所有权限 GRANT ALL PRIVILEGES ON SCHEMA schema_name TO username;
给用户赋予函数的权限
GRANT EXECUTE ON FUNCTION function_name() TO username;
给用户赋予序列的权限
GRANT USAGE, SELECT ON SEQUENCE sequence_name TO username;
给用户赋予语言的权限
GRANT USAGE ON LANGUAGE plpgsql TO username;
从用户或角色中撤销权限
//从 username 用户中撤销 table_name 表的 SELECT 权限 REVOKE SELECT ON TABLE table_name FROM username;
标签:username,postgresql,name,GRANT,--,赋予,相关,权限 From: https://www.cnblogs.com/cgy-home/p/18163342