数据库中创建模式的权限
(1)使用超级用户highgo可以创建schema,但使用普通用户a默认无法创建角色
highgo=#\du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
a | | {}
highgo | Superuser, Create role, Create DB, Replication | {}
highgo=#select current_user;
current_user
--------------
a
(1row)
highgo=#create schema test1;
错误: 对数据库 highgo 权限不够
highgo=#\c highgo highgo
Youare now connected to database "highgo" as user "highgo".
highgo=#select current_user;
current_user
--------------
highgo
(1row)
highgo=#create schema test1;
CREATESCHEMA
(2)在数据库highgo上将create权限赋予a,用户a即可在数据库highgo上创建schema
highgo=#grant create on database highgo to a;
GRANT
highgo=#\c highgo a
Youare now connected to database "highgo" as user "a".
highgo=>create schema test2;
CREATESCHEMA
highgo=>\dn
List of schemas
Name | Owner
----------------+--------
hgdb_catalog | highgo
oracle_catalog | highgo
public | highgo
test2 | a
(4rows)
(3)回收用户a在highgo数据库上的create权限
highgo=#revoke create on database highgo from a;
REVOKE