CREATE USER
Name
CREATE USER -- 定义一个新数据库角色
Synopsis
CREATE USER _name_ [ [ WITH ] _option_ [ ... ] ]
这里的`_option_`可以是:
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| REPLICATION | NOREPLICATION
| CONNECTION LIMIT _connlimit_
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '_password_'
| VALID UNTIL '_timestamp_'
| IN ROLE _role_name_ [, ...]
| IN GROUP _role_name_ [, ...]
| ROLE _role_name_ [, ...]
| ADMIN _role_name_ [, ...]
| USER _role_name_ [, ...]
| SYSID _uid_
描述
CREATE USER
现在是CREATE ROLE的别名。 唯一的区别是CREATE USER
命令缺省假设有LOGIN
, 而CREATE ROLE
缺省是NOLOGIN
。
兼容性
CREATE USER
语句是PostgreSQL扩展。 SQL 标准把用户的定义交给了实现来完成。