CREATE USER

默认情况下,使用LOGIN特权定义一个新的数据库角色。

概要

  1. CREATE USER name [[WITH] option [ ... ]]

其中option可以是:

  1. SUPERUSER | NOSUPERUSER
  2. | CREATEDB | NOCREATEDB
  3. | CREATEROLE | NOCREATEROLE
  4. | CREATEUSER | NOCREATEUSER
  5. | CREATEEXTTABLE | NOCREATEEXTTABLE
  6. [ ( attribute='value'[, ...] ) ]
  7. where attributes and value are:
  8. type='readable'|'writable'
  9. protocol='gpfdist'|'http'
  10. | INHERIT | NOINHERIT
  11. | LOGIN | NOLOGIN
  12. | REPLICATION | NOREPLICATION
  13. | CONNECTION LIMIT connlimit
  14. | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
  15. | VALID UNTIL 'timestamp'
  16. | IN ROLE role_name [, ...]
  17. | IN GROUP role_name
  18. | ROLE role_name [, ...]
  19. | ADMIN role_name [, ...]
  20. | USER role_name [, ...]
  21. | SYSID uid
  22. | RESOURCE QUEUE queue_name
  23. | RESOURCE GROUP group_name
  24. | [ DENY deny_point ]
  25. | [ DENY BETWEEN deny_point AND deny_point]

描述

CREATE USER是CREATE ROLE的别名。

CREATE ROLE和CREATE USER之间的唯一区别是CREATE USER默认情况下假定LOGIN, 而CREATE ROLE默认情况下假定NOLOGIN。

兼容性

SQL标准中没有CREATE USER语句。

另见

CREATE ROLE

Parent topic: SQL Command Reference